Tips for transferring large amounts of data to websites

Source: Internet
Author: User
Tags ssh rsync ssh port

Typically, the steps to transfer a Web site are as follows:

1, close the site to prevent changes in the data during the transfer

2, transfer the data to the new host

3, open the website

But if the site data volume is very large, in the second step is very time-consuming, the site for a long time to shut down will cause a lot of adverse effects.

So here's a more efficient way to introduce you: Rsync.

Rsync can incrementally transfer newly added files, or update files with different contents of two hosts (only the Difference section is transmitted).

The specific way to do this is to determine the time to transfer the site, first on the day before, the implementation of rsync, the data are all transferred to the new server, this period is not required to close the site. In the official transfer site, another rsync, this time need to shut down the site, because this time only the transfer of new and changed files, so the amount of data transmission will be very little, so the time to close the site will be much less.

For example, 10G data Web sites, this approach may reduce the period of interruption during the transfer from a few hours to more than 10 minutes. The larger the amount of data, the more obvious the difference.

Using rsync requires that you install the corresponding packages on both hosts:

Debian/ubuntu:apt-get install-y rsync

Centos:yum install-y rsync

Transfer commands can be performed on both the new host and the old host, but the command format is not the same, assuming that the command is executed on the new host:

Rsync-avz-e ssh root@ip.ip.ip.ip:/source/path//dest/path/

1) Ip.ip.ip.ip is the original host IP

2/source/path/The path for the data to be transferred on the original host

3)/dest/path/for the path to be saved on the new host

The parameter described here is the transmission of data through the SSH service, if the original host's SSH port is not the default 22, you need to specify the SSH port, if the port is 60000, then the command is:

Rsync-avz-e ' Ssh-p 60000′root@ip.ip.ip.ip:/source/path//dest/path/

PS: The command to perform a long operation, preferably running in the screen window.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.