Generally speaking, the steps to transfer a website are as follows: 1, close the website to prevent data changes during the transfer, 2, transfer the data to a new host, 3, open the website

However, if the site data volume is very large, the second step is very time-consuming, the site down for a long time will cause many adverse effects.

So here is a more efficient way: Rsync. Rsync can incrementally transfer newly added files, or update files with different contents between the two hosts (transferring only the differences).

The specific operation mode is as follows: first determine the time to transfer the website, first one day before, execute rsync to transfer all data to the new server, during which there is no need to close the website. When the site is officially transferred, rsync is executed again, this time the site needs to be shut down. Since only the newly added and changed files are transferred this time, the amount of data transferred will be very small, so the shutdown time of the site will be much less.

For example, with 10 gigabytes of data, this approach may reduce the downtime during a transfer from a few hours to a few dozen minutes. The larger the data, the more pronounced the difference.

To use rsync, install the following software packages on both hosts: Debian/Ubuntu: apt-get install -y rsync CentOS: yum install -y rsync

The transfer command can be executed on the new host or the old host, but the command format is different. Assume that the command is executed on the new host, and the command is as follows: Rsync avz – e SSH [email protected]: / source/path / / dest/path / 1) IP. The IP. The IP. The IP for the original host IP 2)/source/path/to need to transfer the data in the original owners of the path of the machine 3)/dest/path/ is the path to be saved on the new host

If the SSH port of the original host is not the default 22, you need to specify the SSH port. If the port is 60000, run the following command: Rsync avz – e ‘SSH -p 60000’ [email protected]: / source/path / / dest/path /

PS: long time operation command, preferably in the screen window run