Sync data between Windows with Rsync (Cwrsyncserver configuration)

Source: Internet
Author: User
Tags locale setting stack trace connection reset

Rsync is an excellent data synchronization software, in cross-server, cross-room, multi-national backup server of the preferred tool, below to describe how to configure the installation Cwrsyncserver most software is B/C architecture, Cwrsyncserver is the Windows version of Rsync

One, download
Official: Official website: http://rsync.samba.org/download.html

http://sourceforge.net/projects/sereds/files/cwRsync/4.1.0/

Server Edition: <ignore_js_op>Cwrsyncserver_4.1.0_installer.rar (3.65 MB, download count: $)
The client version is: <ignore_js_op>Cwrsync_4.1.0_installer.rar (3.4 MB, download count: 153)

Two, installation


Server ip:192.168.1.1
Client ip:192.168.1.2

1, Server installation

The first step: establish the Cwrsyncserver running account, this step is necessary, otherwise you installed even start up not to come OH
User name: Test
Password: Test
and join the Admins group!
Note: This account is just an account for installation and operation, no use

Step Two: Install
Installation

<ignore_js_op>


<ignore_js_op>


<ignore_js_op>


Enter the account you just created

<ignore_js_op>



Click closed after you have finished

Step Three: Configure
The path we follow is: E:\Program files\icw\
Then we're going to go into this directory.
Open rsyncd.conf edit content as follows:

Use Chroot = False
UID = 0
GID = 0
Strict modes = False
Log file = Rsyncd.log
Port = 10556
[WWW]
Path =/cygdrive/c/www
Read Only = False
Transfer logging = yes
Auth users = testuser
Secrets file = Etc/testuser.pas
Hosts allow = 192.168.1.2
Hosts Deny = 0.0.0.0/0

[MySQL]
Path =/cygdrive/d/mysql/mysql Server 5.0/data/bbs
Auth users = testuser
Secrets file = Etc/testuser.pas
Hosts allow = 192.168.1.2
Hosts Deny = 0.0.0.0/0


Then enter the E:\Program files\icw\etc directory to create Testuser.pas text file, note the full name of the file is Testuser.pas

Input:
Testuser:123
That is: The user name is: testuser
Password is: 123
This user is the user name and password to be authenticated by the Client Connection server

Fourth step: Start the service
Run---cmd---services.msc
Start the service:

<ignore_js_op>


Local test: Telnet 127.0.0.1 10556

Firewall remember to open this port

2, Client Installation
Decompression: Cwrsync_4.1.0_installer.zip Follow the wizard installation
Following completion:
CD C:\Program files\cwrsync\bin>

Start the Client Connection server
RSYNC.EXE-VZRTOPG--progress--delete[email protected]92.168.1.1::www/cygdrive/e/databackup/www--port=10556
Enter password

3, set up scheduled Tasks, synchronize data regularly:

Note that the scheduled task is prompted for a password, and the following is a script that does not enter a password
    1. @echo off
    2. "C:\Program files\cwrsync\bin\rsync.exe"-VZRTOPG--progress--delete [email protected]::www/cygdrive/e/databackup/ www--port=10556--password-file=/cygdrive/e/databackup/rsyncpwd.txt < E:\databackup\passwd.txt
Copy Code
Create an empty file name in the E:\databackup directory: rsyncpwd.txt Create a E:\databackup\passwd.txt and enter the password

No, this time, the following error occurred:password file must not being other-accessible

Password file must is owned by root when running as root


Downstairs will give a few common problems

After installing the Cwrsync client, start writing bat execution file, the first thing encountered is to synchronize to the local directory does not know, error is as follows:

The source and destination cannot both be remote.
Rsync Error:syntax or usage error (code 1) at MAIN.C (1138) [receiver=3.0.7]

The main reason is that Cwrsync can not directly understand the site, must add/cygdrive/g/test

Meaning for the G:\test directory

The client password file error is as follows:

rsync password file must is owned by root when running as root

Almighty Google tells me, can be solved in a flexible way is

@echo off
"C:\Program Files (x86) \cwrsync\bin\rsync"-rlptdzv--progress--delete "[Email protected]::test"/cygdrive/g/test-- Password-file=/cygdrive/g/rsync/passws.ps<g:\rsync\passwd.txt

Under G:\rsync, a file is created, a password is written, and then the synchronization password is entered in this file. As in the example above.

A summary of rsync issues

When synchronizing data with rsync, there are often some problems that I will encounter as follows:
1. Permissions issues
A hint similar to the following: Rsync:opendir "/kexue" (in Dtschannel) Failed:permission denied (13) Note to see if the directory permissions for synchronization are 755
2. Time Out
rsync:failed to connect to 203.100.192.66:connection timed out (110)
Rsync error:error in Socket IO (code ten) at CLIENTSERVER.C (124) [receiver=3.0.5]
Check the server's port NETSTAT–TUNLP, remote Telnet test.
3. Service not Started
rsync:failed to connect to 10.10.10.170:connection refused (111)
Rsync error:error in Socket IO (code ten) at CLIENTSERVER.C (124) [receiver=3.0.5]
Start service: rsync--daemon--config=/etc/rsyncd.conf
4. Full disk space
Rsync:recv_generator:mkdir "/teacherclubbackup/rsync ..." failed:no space left on device (28)
Skipping any contents from this failed directory * * *
5, CTRL + C or a large number of files
Rsync error:received SIGINT, SIGTERM, or SIGHUP (code) at RSYNC.C (544) [receiver=3.0.5]
Rsync error:received SIGINT, SIGTERM, or SIGHUP (code) at RSYNC.C (544) [generator=3.0.5]
6, Xnetid start
Rsync:read error:connection Reset by Peer (104)
Rsync Error:error in Rsync protocol data Stream (code) at IO.C (759) [receiver=3.0.5]
View Rsync logs
Rsync:unable to open configuration file "/etc/rsyncd.conf": No such file or directory
Xnetid find the profile location by default is/etc, creating a soft link depending on the situation. For example:
Ln-s/etc/rsyncd/rsyncd.conf/etc/rsyncd.conf

Common errors:

Error One
rsync:failed to connect to 96.44.169.178 (*inet_ntop failed*): Connection timed
Out (116)
1 [main] rsync 3468 exception::handle:exception:status_access_violation
740 [main] rsync 3468 open_stackdumpfile:dumping stack trace to RSYNC.EXE.S
Tackdump
1, firewall issues
2, Port not

Error two
@ERROR: Auth failed on module www
Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1516) [Rec
eiver=3.0.8]
Wrong password

Error three
@ERROR: Invalid UID Nobody
Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1516) [Rec
eiver=3.0.8]
UID is incorrect, default is nobody
Workaround:
UID = 0
GID = 0

Error Four
Receiving incremental file list
Rsync:read error:connection Reset by Peer (104)
Rsync Error:error in Rsync protocol data Stream (code) at IO.C (769) [Receive
r=3.0.8]
Rsync:connection unexpectedly closed (bytes received so far) [generator]
Rsync Error:error in Rsync protocol data Stream (code) at IO.C (610) [Generat
or=3.0.8]
Possible causes:
1, Disk mount is asynchronous (async)
Then, check the/etc/fstab and remove the async parameter.

2, I look at the log on the server and see a line like this:
Rsync:unable to open configuration file "/etc/rsyncd.conf": No such file or directory

So I:
Ln-s/etc/rsyncd/rsyncd.conf/etc/rsyncd.conf

3, there is a large number of synchronization files directory error
There are more files in the subdirectory, it will be 8,000 or so, always sync half of the exit. Add the-v parameter to the batch and see the error message as follows:
Rsync:writefd_unbuffered failed to write 4 bytes to socket [Sender]: Connection Reset by Peer (104)
Rsync:read error:connection Reset by Peer (104)
Rsync Error:error in Rsync protocol data Stream (code) at IO.C (768) [sender=
3.0.6]

This problem a little headache, in the Www.itefix.no website forum also failed to find out why.

Eventually, however, the solution was found on samba.org:

Add the--no-iconv parameter to the client command line.

The original thought is too many files, buffer is not enough to cause, but look at this solution, seems to be the conversion coding aspects of the bug.

The following are described in the rsync documentation:
Http://rsync.samba.org/ftp/rsync/rsync.html
--iconv=convert_spec
Rsync can convert filenames between character sets using this option. Using a convert_spec of "." tells Rsync to look up the default Character-set via the locale setting. Alternately, you can fully specify what conversion to does by giving a local and a remote charset separated by a comma in th E order--iconv=local,remote, e.g.--iconv=utf8,iso88591. This order ensures the option would stay the same whether you ' re pushing or pulling files. Finally, you can specify either--no-iconv or a convert_spec of "-" to turn off any conversion. The default setting of this option are site-specific, and can also be affected via the RSYNC_ICONV environment variable.

Sync data between Windows with Rsync (Cwrsyncserver configuration)

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.