Remote data synchronization on Windows servers using cwRsync

Source: Internet
Author: User
Tags port number rsync

1. Introduction to cwRsync
CwRsync is the implementation version of Rsync on Windows. By using the file transfer technology of specific algorithms, Rsync can transmit only modified files over the network.
CwRsync is mainly used for remote file sync backup and synchronization on Windows. It contains Cygwin DLL and Rsync of the applicable Cygwin version.
CwRsync is divided into Server and Client. The version used in this article is 4.1.0. The download address is as follows:
CwRsyncServer v4.1.0: http://pan.baidu.com/s/1eQpaIVw
CwRsync v4.1.0: http://pan.baidu.com/s/1pJ3B1FX
The following is an example of Server and Client configuration. The environment used in this article is as follows:
Server: 192.168.85.236
Client: 192.168.85.249

2. Server installation and use
2.1 Installation
Click Next and use the default configuration for installation.
2.2 Configuration
Modify the configuration file rsyncd. conf as follows (default location: C: \ Program Files \ ICW \):

Use chroot = false
Strict modes = false
Hosts allow = *
Log file = rsyncd. log
Pid file = rsyncd. pid
Port = 873
Uid = 0
Gid = 0

# Module definitions
# Remember cygwin naming conventions: c: \ work becomes/cygwin/c/work
#
[Test]
Path =/cygdrive/d/test
Read only = false
Transfer logging = yes

Some important parameters are described as follows:

Use chroot = false
Strict modes = false
Hosts allow = * # allow access from all IP addresses
Log file = rsyncd. log # log file
Pid file = rsyncd. pid # process file
Port = 873 # Service port number
Uid = 0 # unlimited users
Gid = 0 # unrestricted group

# Module definitions
# Remember cygwin naming conventions: c: \ work becomes/cygwin/c/work
#
[Test] # Name of the authenticated module, which must be specified on the client
Path =/cygdrive/d/test # directory for image synchronization, such as d:/test
Read only = false
Transfer logging = yes

Note:
1. uid = 0 and gid = 0 must be specified. Otherwise, an error will be reported when the client is synchronizing data later:
@ ERROR: invalid uid nobody
Rsync error: error starting client-server protocol (code 5) at main. c (1516) [runner er = 3.0.8]
2. The above is just a simple configuration example. There are many other options. For details, refer to the Help File: C: \ Program Files \ ICW \ doc \ rsyncd.conf.html.
2.3 start the service
Run services. msc on the Server and select "RsyncServer" to set the startup type to "automatic". Then, start the service.




3. Install and use the Client

3.1 Installation
Same as Server, click Next and use the default configuration for installation.
3.2 Use
Create a test. bat file with the following content:

@ Echo off
Set RSYNC_HOME = C: \ Program Files \ cwRsync \ bin
Cd % RSYNC_HOME %
C:
Rsync-avzP -- progress -- delete rsync: // 192.168.85.236: 873/test/cygdrive/d/test

Command parameters:

-AvzP
-A parameter, equivalent to-rlptgoD:
-R is recursion
-L indicates a link file, which means copying a link file.
-P indicates that the original file permission is maintained.
-T preserve the original time of the file
-G: Original User group for retaining files
-O maintain the original owner of the file
-D is equivalent to a block device file.

-V verbose output
-Z compression during transmission
-P: shows the transmission progress.

-- Progress displays the backup synchronization process
-- Delete: delete files that are not available to the Server in the Client. That is, if the Server deletes the file, the client also deletes the file accordingly to ensure true consistency.

Rsync: // 192.168.85.236: 873/test configure the Sever IP address and the name of the module to be synchronized (configured in Server rsyncd. conf)
/Cygdrive/d/test local Client directory for storing synchronization files D: \ test

Run bat and the Client will perform remote file synchronization. The screenshot is as follows:

 

 

3.3 test

In the above environment, the synchronization test of a large number of files is conducted, and the results are as follows:

 

1. During each synchronization, the client obtains the list of updated files. A large number of files (2.7 w 27.5G) takes a long time (5min47s)

2. Incremental update takes a short time. It takes only 16 s to update 100 files (minus the time used to obtain the list).

4. Scheduled task configuration

1. Select Control Panel> task plan> add task plan on the client machine.

2. Click next-> Browse to open the test. bat file above.

 

 

3. Select to execute once a day

 

 

4. Configure the start time

 

 

5. Click next and enter the server user name and password to complete task addition.

 

 

6. Select the task you just added and configure properties: Daily schedule-> Advanced. Select "repeat task". The task is executed every 20 minutes for a period of 24 hours.

 

 

At this time, the scheduled task runs 24 hours a day every 20 minutes to automatically synchronize data between the client and the Server.

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.