How to install the Rsync file backup tool in Windows

Source: Internet
Author: User
Tags anonymous auth posix socket connection reset windows download zip rsync

Rsync is a good free synchronization software for files. It can mirror and save the entire directory tree and file system, while maintaining the permissions, time, and soft links of the original file. During the first synchronization, rsync copies all the content and transfers only the modified part of the file next time. During data transmission, compression and decompression can be performed to reduce bandwidth traffic. Supports scp, ssh, and direct socket connections, and anonymous transmission. Supports Linux and Windows platforms. When writing this article, the latest version of window is 4.0.5.

Official website: http://rsync.samba.org/

Download Linux: http://rsync.samba.org/download.html

Windows Download: https://www.itefix.no/i2/cwrsync-get (Free Edition)

Client: cwRsync 4.0.5 Installer

Server: cwRsyncServer 4.0.5 Installer

The official paid version is now available. We recommend that you download the free version from your feet.

CwRsync win server synchronization software cwRsync_2.1.5_Installer.zip

Server data synchronization server cwRsync_Server_2.1.5_Installer.zip

Server file sync cwRsync_3.1.0_Installer.zip

Server file sync software server cwRsyncServer_3.1.0_Installer.zip

1. Install and configure the Rsync server

Windows Server:

1. Click the server installation program to install it. During the installation process, the system prompts you to enter the user name and password for the server program to run the service. It can be customized or set with the default user name and password.

2. After the installation is complete, go to the root directory of the Program installation directory, open the configuration file (for example, C: Program FilesICWrsyncd. conf), and enter the configuration.

Use chroot = false
Strict modes = false
Lock file = rsyncd. lock
Hosts allow = 192.168.1.21
Max connections = 5
Port = 28950
Pid = 0
Uid = 0

Log file =/cygdrive/f/RsyncLog/rsyncd. log

# Module definitions
# Remember cygwin naming conventions: c: work becomes/cygdrive/c/work

[Data_backup]
Path =/cygdrive/f/dataBackup
Auth users = dbbackuper
Secrets file =/cygdrive/e/Setting/Rsync/rsync_db.ps
Read only = no
List = no
Transfer logging = yes

Currently used

Use chroot = false
Strict modes = false
Hosts allow = 222.186.55.55
Log file = rsyncd. log
Pid file = rsyncd. pid

 

# Module definitions
# Remember cygwin naming conventions: c: work becomes/cygwin/c/work
#
[Dddown]
Path =/cygdrive/d/webroot/downjb51
Read only = false
Transfer logging = yes
Auto user = wtjb51
Secrets file = wtjb51.conf

[Scjb51]
Path =/cygdrive/d/webroot/scjb51
Read only = false
Transfer logging = yes
Auto user = wtjb51
Secrets file = wtjb51.conf

The above Windows directory should be written in the POSIX style. By default, cygwin does not seem to work, but cygdrive, such as D:/data, to write/cygdrive/d/data.

The above configuration only allows access from 192.168.1.21, which can be modified as needed.

Strict modes = false do not verify the user password,

Pid = 0, uid = 0 specify anonymous access.

Auth users: the user name used to access data_backup

Secrets file: password file corresponding to the data_backup user name.

3. Create a new password file: E: SettingRsyncrsync_db.ps. For example:

Root: root

Admin: 12345

Password file format: user name: password (root: 12345), one line, some systems do not support long passwords, the permissions of the other password file are not readable to other user groups, if it is set incorrectly, it may not work. In Windows, the access permission to the password file must be set correctly. Otherwise, the password cannot be accessed during user authentication. The permission of the password file E: SettingRsync rsync_db.ps should be added to the read permission of the user name cwRsyncServer of the Rsycn service running service and set it as the owner of the file.

 

4. In the service manager, locate the RsyncServer service and start the service.

5. If the firewall is enabled, add Tcp port 28950 to the firewall rules to allow communication.

 

6. for service verification, open the doscommand box and enter telnet 192.168.1.20 28950 (if the telnet server and client are not installed, go to Control Panel> add or delete a program> enable or disable windows, find the Telnet client and server, and select the check box to install the program ). If telnet can be connected successfully and similar text such as @ RSYNCD: 30.0 appears, the service is started normally.

 

II. Install and configure the Rsync client

1. Install the Rsync client until the installation is complete.

2. Test the connectivity of server Rsync. Telnet to the computer where the Rsync client is located the corresponding address and port for calculation on the Rsync server.

Telnet 192.168.1.20 28950.

If a message similar to @ RSYNCD: 30.0 is displayed, the client can connect to the server normally.

 

3. Open the doscommand window and go to the bin directory of the Rsync client installation directory, for example, C: Program FilescwRsyncbin. Run the following command to start synchronization:

Cd C: Program FilescwRsyncbinrsync -- port = 28950-vzrtopg -- progress -- delete 192.168.1.20:

Parameter description:

-- Port = 28950 # port-vzrtopg -- progress # display detailed information about the synchronization process -- delete # delete data from the client directory that is different from the server directory, ensure that the data on both sides is completely consistent./cygwin/f/dataBackup # directory F: dataBackupdata_backup in the Window # server configuration file rsyncd. the module name defined in the conf file 192.168.1.20 # Rsync server IP address

The user who sets this command file needs to add the permission to read the password file and add it as the file owner. As follows:

 

4. Add a System Plan for regular execution

Create the command execution file C: Program FilescwRsyncbinSyncDB_NoAuth.cmd. Save the following command to the file:

Rsync -- port = 28950-vzrtopg -- progress -- delete 192.168.1.20: data_backup/cygwin/f/dataBackup -- password-file =/cygdrive/e/Setting/Rsync/rsync_db.ps

Adding a Task Scheduler to a Window varies with systems.

Windows xp/Server 2003: Start-> Settings-> Control Panel-> task plan-> Open add task plan-> Next

Windows 7/Server 2008: Start-> Control Panel-> Administrative Tools-> task plan

 

 

 

III. Configuration item resolution

IV. FAQs about installation and configuration

Error 1: rsync: read error: Connection reset by peer (104)

Rsync error: error in rsync protocol data stream (code 12) at io. c (794) [receive r = 3.0.2]

Solution: The rsync service is not enabled on the server. Enable the service.

ERROR 2: @ ERROR: chdir failed

Rsync error: error starting client-server protocol (code 5) at main. c (1495) [runner er = 3.0.2]

Solution: The synchronization directory on the server has no permission. The default user of cwrsync is Svcwrsync. Add the user Svcwrsync permission to the synchronization directory.

ERROR 3: @ ERROR: failed to open lock file

Rsync error: error starting client-server protocol (code 5) at main. c (1495) [runner er = 3.0.2]

Solution: add lock file = rsyncd. lock to the configuration file rsync. conf.

Error 4: rsync: cocould not open password file "/cygwin/e/Setting/Rsync/rsync_db.pwd": No such file or directory (2)

Solution: The password file directory must exist and should be written in the POSIX style:/cygdrive/e/Setting/Rsync/rsync_db.pwd

ERROR 5: @ error: auth failed on module data_backup rsync error: ERROR starting client-server protocol (code 5) at main. c (1506) [runner er = 3.0.7]

Solution: The password is incorrect. Enter the correct password. If both the user name and password are correct, it may be that the account password file permission of the remote rsync server must be 600.

Error 6: password file must not be other-accessible

Solution: This is because rsyncd. pwd rsyncd. sec has incorrect permissions and should be set to 600. For example: chmod 600 rsyncd. pwd. In Windows, replace the owner of the password file with the user who runs the program.

ERROR 7: @ error: invalid uid nobody. rsync error: ERROR starting client-server protocol (code 5) at main. c (1506) [runner er = 3.0.7]

Solution: add the following two lines to the rsyncd. conf file.

Uid = 0

Gid = 0

Problem 8: @ ERROR: chroot failed

Rsync error: error starting client-server protocol (code 5) at main. c (1522) [runner er = 3.0.3]

Cause: The directory on the server does not exist or has no permission. Creating a directory and correcting permissions can solve the problem.

Question 9: @ ERROR: Unknown module 'Tee _ nonexists'

Rsync error: error starting client-server protocol (code 5) at main. c (1522) [runner er = 3.0.3]

Cause: The specified module does not exist on the server. Provide the correct module name or modify it on the server to the module you want to solve the problem.

Problem 10: rsync: failed to connect to 218.107.243.2: No route to host (113)

Rsync error: error in socket IO (code 10) at clientserver. c (104) [handler er = 2.6.9]

Cause: it is possible that the other party does not start the instance, the firewall blocks the instance, or the firewall blocks the instance on the network. To disable the firewall, you can open tcp udp 873 or the specified rsync port.

Problem 11: rsync error: error starting client-server protocol (code 5) at main. c (1524) [cycler = 3.0.7]

Cause: The content of the/etc/rsyncd. conf configuration file is incorrect. Check the configuration file correctly.

Question 12: rsync: chown "" failed: Invalid argument (22)

Cause: The permission cannot be copied. Remove the synchronization permission parameter. (This is usually the case when Linux is switched to Windows)

Question 13: @ ERROR: daemon security issue -- contact admin

Rsync error: error starting client-server protocol (code 5) at main. c (1530) [sender = 3.0.6]

Cause: The synchronization directory contains a soft connection file. You need to enable use chroot = yes on the server/etc/rsyncd. conf. Pass through the soft connection file.

Question 14: rsync: read error: Connection reset by peer (104)

Rsync error: error in rsync protocol data stream (code 12) at io. c (794) [runner er = 3.0.2]

Solution: it is very likely that the server has not enabled the rsync service.

When the rsyncserver service is started, an error is reported, "the rsyncserver service stops again after it is started. Some services are automatically stopped if they have nothing to do, such as the performance log and alarm service ."

Solution: delete the rsyncd. pid file in the installation directory and restart the RsyncServer service. It is generally caused by abnormal shutdown.

In order to save trouble, I wrote a batch directly, and regularly checked whether the rsync server was running.

Copy the code as follows:

@ Echo off

For/f "usebackq" % I in ('"tasklist | find/c" cygrunsrv.exe ""') do (

Set chkstat = % I

)

If % chkstat % = 0 (

Del "D: Program FilescwRsyncServerrsyncd. pid"/f

Net start RsyncServer

Echo ========================>> % date :~ 0, 10%. log

Echo % date % time % check rsync service stop> rsync % date :~ 0, 10%. log

Echo restart rsync service! >>% Date :~ 0, 10%. log

Echo ========================>> % date :~ 0, 10%. log

)

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.