Beyond‘s blog

IT/Web Technology

【Data Migration】Migrating a Website to a New Server Environment

We recently received the following consultation from a client.

We received an emergency notice from our current IDC (Internet Data Center) regarding the termination of their services due to aging server infrastructure and business restructuring.

As a result, we need to migrate all data from our current server environment to a new one within a tight two-week window, and we are requesting your support for this transition.

This essentially meant it was a critical situation: “Once the migration deadline passes, the existing server environment will be forcibly shut down and deleted, rendering the website and all associated resources completely inaccessible.”

 

① Analysis of Old Server Environment and Active Services, Migration Preparation

In response to this emergency, our company developed the following plan and proceeded with the server migration work.

Typically, before a server migration, we identify the following information via the web console provided by the IDC:

  • Server Configuration (Server region, OS version, IP address, DNS, CPU, memory, disk, network bandwidth, etc.)
  • Resource Availability (Databases, SSL, CDN, domains, etc.)

However, the old server environment in this case was unique, and the web console was inaccessible. Therefore, we conducted thorough hearings with the client (and their development engineers).

As a result, we determined that the system is a PHP-based UGC (User-Generated Content) site for a specific industry, featuring WeChat Official Account integration and online payment functions.

 

Investigation Results of the Old Server Environment

Through further detailed investigation, we gained an understanding of the approximate configuration of the website and server environment.

Category Item Configuration Details
Server Environment OS CentOS 7.9.2009
CPU 4core
Memory 8GB
System Disk 40GB
Data Disk 200GB
Network Bandwidth 10Mbps(Single line)
Software Environment Web Server Nginx 1.24
Database MySQL 5.7.44
Programming Language PHP 7.4
Cache Redis 6.2
File Transfer FTP(vsftpd)
Management Tool phpMyAdmin 5.1
WAF ModSecurity
SSL Certificate Available
Control Panel Pagoda Panel(宝塔面板)

 

② Log Into the Old Server Environment via SSH Tool (Xshell)

Our engineers attempted to log into the old server via SSH using Xshell, but the connection could not be established. Furthermore, the server was inaccessible even via local CMD commands (TCP/IP).

Upon investigation, it was discovered that the network provider used by the IDC server room had withdrawn, leaving only the China Mobile network active.

Ultimately, we prepared a temporary “Relay Server (Linux Jump Box)” utilizing the China Mobile network. By first connecting to this relay server via Xshell and then executing the ssh root@127.0.0.1 command, we successfully established a connection to the old server.

# ssh conntect old linux server
ssh root@192.168.1.2
# write old server 192.168.1.2 pwd

 

③ Backup of the Old Server Environment (Programs + Database)

We connected to the old server via the relay server and compressed/packaged the server data, program source code, and database.

First, we verified the directory structure and capacity of both the system and data disks to determine the scope and total size of the migration.

# Display disks
[root@MyCloudServer ~]# df
# List directories
[root@MyCloudServer ~]# ls /path/to/directory
# Check CPU information 
[root@MyCloudServer ~]# ls lscpu
# Back up all databases
[root@MyCloudServer ~]# mysqldump -u[username] -p --all-databases | gzip > /path/to/backup_file.sql.gz
# Back up a single database
[root@MyCloudServer ~]# mysqldump -u[username] -p[password] [database_name] > /path/to/backup_file.sql

 

④ Bulk Data Transfer From the Old Server Environment to the Relay Server

Another challenge was that the old server lacked a dedicated administrator responsible for regular backups and monitoring.

Furthermore, since the client utilized a low-cost local IDC service rather than a major cloud platform like Alibaba Cloud or AWS, security and operational efficiency had not been a primary consideration.

As a result, the server’s backup capabilities were insufficient; although the website’s program volume totaled 160GB, the available backup capacity was only 40GB. To address this, we implemented a batch processing approach, migrating data according to the following priorities:

  1. Package PHP source code and MySQL databases, then transfer them to the verification server.
  2. Batch package large files (such as images) and transfer them.
  3. Migrate website data and server logs together.
  4. Package the entire server configuration—including Nginx, MySQL, and PHP settings—for a complete transfer.
# Transfer the compressed package
[root@MyCloudServer ~]# scp /local/path/backup.tar.gz username@remote_host:/remote/path/
# Transfer a directory
[root@MyCloudServer ~]# scp -r /local/directory/ user@remote_host:/remote/path/

 

⑤ Data Integrity Verification and Backup

Since the IDC provided only a single China Mobile line, we experienced drops in transfer speeds and frequent disconnections during large-scale data downloads.

As a result, we implemented the following measures:

  • Conducted a detailed audit of the website’s program components and prioritized them by transfer size and importance.
  • Maintained continuous monitoring of the data transfer status.
  • Performed multiple backup cycles to cross-reference and verify data consistency.

Furthermore, to prevent data loss, we established a temporary test environment on the relay server to verify data integrity. We paid particularly close attention to potential data gaps or character encoding issues during database transfers caused by the unstable connection.

After approximately three days of work, we successfully completed the full migration from the old server to the relay server. We then confirmed the data integrity and normal website functionality within the test environment.

Following this, we designed and built the new production server environment. After performing image data optimization (removing duplicates, compression, and deleting unused assets), we migrated the data to the new environment for final production release.

Through these steps, the client was able to successfully overcome the imminent crisis of their service being shut down.

 

Side Note: Why Do Sudden IDC Service Shutdowns Occur?

The IDC originally used by this client was a small-scale, local IDC within China.

In principle, operating an IDC involves massive overhead costs, such as rack leasing, electricity, bandwidth fees, hardware procurement, maintenance, and labor.

However, global cloud platforms—led by giants like Alibaba Cloud—now offer services at such low prices that small-scale IDCs can no longer compete.

As a result, it appears the IDC in this case, having lost its competitive edge, was forced to abruptly terminate its services.

 

Summary

When contracting or utilizing a new server, we recommend selecting a highly reliable IDC or a global cloud platform.

In particular, for projects requiring online payments or high levels of data security, the following global cloud platforms are most suitable:

  • Alibaba Cloud: Widely used across China and worldwide.
  • AWS: Possesses an extensive track record in Japan, North America, and Europe.

These providers ensure stable access, network redundancy, and data security through their globally distributed IDCs.

For needs such as corporate digitalization, overseas expansion, and cross-border trade, cloud platforms with global capabilities offer a significant advantage.

 

Related Services

Website Development https://beyond-shenzhen.cn/en/service/website
Managed Cloud Services https://beyond-shenzhen.cn/en/service/server

 

For Website Development and Managed Cloud Services

 

Conact Us

  • ▼ Company WeChat Official Account▼

  • ▼ Contact person in charge WeChat ID ▼

咨询/联系我们

CONTACT

Inquiry/Contact Us

WeChat Official Account