How to configure Rsync synchronization files in Windows _win Server

Source: Internet
Author: User
Tags anonymous auth posix connection reset file permissions rsync

Rsync is a good file free synchronization software, can be mirrored to save the entire directory tree and file system, while maintaining the original file permissions, time, soft and hard links. At the first synchronization, rsync copies the entire contents and transfers only the modified portion of the file the next time. In the process of transmitting data, compression and decompression can be implemented to reduce the bandwidth flow. Supports SCP, SSH, and direct socket connections to support anonymous transmission. Support Linux,window platform. When writing this article, the window version of the latest version of the 4.0.5 Edition

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

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

Windows version download: Https://www.itefix.no/i2/cwrsync-get (free Edition Edition)

Client: Cwrsync 4.0.5 Installer

Service side: Cwrsyncserver 4.0.5 Installer

Now the official start of the fee version, recommended to download the free version from the cloud Habitat community

    • Cwrsync win server sync software cwrsync_2.1.5_installer.zip
    • Server data Synchronization server-side Cwrsync_server_2.1.5_installer.zip
    • Server file Synchronization Cwrsync_3.1.0_installer.zip
    • Server file sync software server side Cwrsyncserver_3.1.0_installer.zip

First, installation configuration Rsync service side

Window version Service side:

1. Click on the service-side installer to install, the installation process prompts to enter the service-side program to the Service runtime username, password. You can customize it, or you can use the default username password setting.

2. After the installation completes, enters the program installation directory root directory, opens the configuration file (for example: C:\Program files\icw\rsyncd.conf), enters the configuration.

Copy Code code as follows:

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


Used by the cloud-dwelling community.

Copy Code code as follows:

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 according to POSIX style, the default configuration file Cygwin seemingly not work, but to write cygdrive, such as D:/data, to write/cygdrive/d/data.

The above configuration allows only 192.168.1.21 access, and is modified here as needed.

Strict modes = False does not validate user passwords.

PID = 0,uid = 0 Specifies anonymous access.

Auth users: Refers to the user name of the access Data_backup

Secrets file:data_backup the password file corresponding to the username.

3. New password file: E:\Setting\Rsync\rsync_db.ps. Such as:

Root:root

admin:12345

Password file format: Username: password (root:12345), one line, some system does not support long password, the other password file permissions to other user groups are unreadable, set the wrong may not work. Under Windows, password file access must be set correctly, otherwise the user will not pass the verification. You should add the permissions of the password file E:\Setting\Rsync\rsync_db.ps to the Read permission of the user name cwrsyncserver the RSYCN service running the service and set it as the owner of the file.

4. In the Service Manager, locate the service Rsyncserver service and start the service.

5. If the firewall is turned on, TCP port 28950 will be added to the firewall rules to allow traffic.

6. Service verification, open the DOS command box, enter Telnet 192.168.1.20 28950 (if you do not have the Telnet server and client installed, add the removal program in Control Panel->-> Turn on the Turn off Windows feature to locate the Telnet client and service side, and check for installation. If Telnet can successfully connect, and similar text such as @rsyncd:30.0 appears, then the service starts properly.

II. Installation Configuration Rsync Client

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

2. Test the connectivity of the server rsync. The corresponding address and port at which the Rsync client resides on the computer telnet to the rsync server

Telnet 192.168.1.20 28950

When similar text such as @rsyncd:30.0 appears, the client connection server is in a normal state.

3. Open the DOS command window and go to the bin directory of the Rsync client installation directory, such as: C:\Program files\cwrsync\bin\. Enter the following command to begin the synchronization:

CD C:\Program files\cwrsync\bin\rsync--port=28950-vzrtopg--progress--delete 192.168.1.20::d ata_backup/cygwin/f/ DataBackup--password-file=/cygdrive/e/setting/rsync/rsync_db.ps

Parameter description:

--port=28950 # port-VZRTOPG--progress # shows synchronization process details--delete # deletes different data from the client directory from the server directory to ensure that the data on both sides is identical/cygwin/f/databackup Window Directory F:\dataBackupdata_backup # server-side configuration file rsyncd.conf the module name defined in the file 192.168.1.20 # rsync server IP Address

The user who set up the command file needs to add the Read permission for the password file and add it as the file owner. As follows:

4. Add System plan Regular execution

The new command executes the file C:\Program files\cwrsync\bin\syncdb_noauth.cmd. Save the following command to the file:

rsync--port=28950-vzrtopg--progress--delete 192.168.1.20::d ata_backup/cygwin/f/databackup--password-file=/ Cygdrive/e/setting/rsync/rsync_db.ps

Add a task schedule to the window, and different systems operate a little differently.

Windows Xp/server 2003: Start-> Settings-> Control Panel-> Task Schedule-> Open Add task Schedule-> Next

Windows 7/server 2008: Start-> Control Panel-> management Tools-> Task Scheduler

Third, configuration item resolution

Iv. common problems in installation and configuration

Error 1:rsync:read error:connection reset by Peer (104)
Rsync Error:error in Rsync protocol The data Stream (code) at IO.C (794) [Receive r=3.0.2]
Workaround: It is likely that the server side did not turn on rsync services. Open the service.


Error 2: @ERROR: ChDir failed
Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1495) [receiver=3.0.2]
Workaround: Server-side Sync directory does not have permissions, cwrsync Default User is Svcwrsync. Add user Svcwrsync permissions for the synchronization directory.


Error 3: @ERROR: Failed to open lock file
Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1495) [receiver=3.0.2]
Workaround: Add lock file = Rsyncd.lock to the profile rsync.conf to resolve.

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

Resolution: The directory of password files must exist, and to use 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) [receiver=3.0.7]

Resolve: Password error, enter the correct password can be. If both the username and password are correct, the remote rsync server's account password file must have a permission of 600.

Error 6:password file must not is other-accessible

Workaround: This is because the Rsyncd.pwd rsyncd.sec permissions are not correct and should be set to 600. For example: chmod rsyncd.pwd, Windows should change the owner of the password file to the user who is running the program.

ERROR 7: @ERROR: Invalid UID nobody. Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1506) [receiver=3.0.7]
Workaround: Add the following two lines to the rsyncd.conf file
UID = 0
GID = 0

Question 8: @ERROR: Chroot failed
Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1522) [receiver=3.0.3]
Reason: The server-side directory does not exist or does not have permissions. Creating a directory and correcting permissions resolves the problem.

Question 9: @ERROR: Unknown module ' tee_nonexists '
Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1522) [receiver=3.0.3]
Reason: The specified module is not present on the server. Provide the correct module name or modify the server side to the module you want to solve the problem.

Question 10:rsync:failed to connect to 218.107.243.2:no route to host (113)
Rsync error:error in Socket IO (code ten) at CLIENTSERVER.C [receiver=2.6.9]
Reason: The other side did not boot, firewall block, through the network firewall blocked, it is possible. Shutting down the firewall is actually opening the TCP UDP 873 or the specified rsync port.

Problem 11:rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1524) [receiver=3.0.7]
Reason:/etc/rsyncd.conf configuration file content has errors. Please check the configuration file correctly.

Question 12:rsync:chown "" failed:invalid argument (22)
Reason: Permission cannot be copied. Remove the parameters for the sync permission. (This happens more often when Linux is to Windows)

Question: @ERROR: Daemon Security Issue-contacts admin
Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1530) [sender=3.0.6]
Cause: The synchronized directory has soft connection files that require server-side/etc/rsyncd.conf to open use Chroot = yes. Skim soft connection files.



Problem 14:rsync:read error:connection Reset by Peer (104)
Rsync Error:error in Rsync protocol The data Stream (code) at IO.C (794) [receiver=3.0.2]
Resolve: It is likely that the server side does not open Rsync services, open services.

Rsyncserver service startup times wrong "the Rsyncserver service started and stopped. Some services automatically stop if they have nothing to do, such as the Performance Logs and Alerts service. ”

Workaround: Remove the Rsyncd.pid file under the installation directory and restart the Rsyncserver service. is usually caused by abnormal shutdown.

In order to save the cloud Community small series directly write a batch, check the rsync server side is not running, no run can.

Copy Code code as follows:

@echo off
for/f "Usebackq"%%i in (' "Tasklist|find/c" Cygrunsrv.exe "") Does (
Set chkstat=%%i
)
If%chkstat% = 0 (
Del "D:\Program Files\cwrsyncserver\rsyncd.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
)

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.