Windows serves as a file server, uses Rsync's version of Windows Services, and then configures it well. You need a friend to refer to below.
Windows serves as a file server, using Rsync's version of Windows services: cwrsyncserver:http://rsync.samba.org
The installation process to set the account number and password for the system service, you can default.
Note: This account is used to enable the Crsync Server service and needs to be assigned to account for the appropriate permissions to synchronize files, otherwise the synced files cannot be manipulated.
Target: Multi-server file synchronization
Environment: 2 sets of CentOS5.6
Web side: 192.168.20.20
Backup side: 192.168.20.21
Backup directory required: 192.168.20.20:/USR/LOCAL/WEB1/USR/LOCAL/WEB2
The first step: server-side configuration
#rpm –qa |grep rsync && rpm–e rsync-**--dodeps
If not, download the installation Yourself (yum–y install rsync)
#cd/usr/local/# wget http://www.samba.org/ftp/rsync/src-previews/rsync-3.0.6pre1.tar.gz #tar –ZXVF rsync-3.0.6pre1.tar.gz #cd rsync-3.0.6pre1 #./configure–prefix=/usr/local/rsync # make && make install # VI /etc/rsyncd.conf
UID = Nobodygid = Nobodyuse chroot = Nomax Connections = 4pid File =/usr/local/rsync/pid/rsyncd.pidlock File =/usr/local /rsync/pid/rsync.locklog file =/usr/local/rsync/pid/rsyncd.logsecrets file=/usr/local/rsync/pwd/rsyncd.pwdhosts Allow = 192.168.20.0/24hosts deny = * [web1]path=/usr/local/web1comment = backup Web1ignore errorsread only = Yes#list = N OAuth users = web1 [web2]path=/usr/local/web2comment = Backup Web2ignore errorsread only = Yes#list = Noauth users = web2
UID = nobody//specify user identity during file transfer
GID = nobody//Specify group identity during file transfer
Log file =/var/log/rsyncd.log//Specifies the location to use separate log files
PID file =/var/run/rsyncd.pid//save PID to the specified file for the purpose of terminating the process with a script
Read Only = yes//The directory is set to read-only, which allows the client to synchronize only downstream and does not allow uploads. If you need to restore data from a backup machine, change to No
RSYNCD default on the 873 Port listening service, you can use Telnet connection in the client to test
# mkdir-p/usr/local/pid # mkdir-p/usr/local/pwd # Vi/usr/local/rsync/pwd/rsyncd.pwd
Web1:[email protected] Web2:[email protected]
Format: User name: Password
Setting the password file can only be accessed by the root user
#chmod 600/usr/local/rsync/pwd/rsyncd.pwd # Cp/usr/local/rsync/bin/rsync /usr/bin/
Start the Rsync service on the server side
# Rsync–daemon (note: After restarting kill, remove the. pid. Lock)
Step two: Configuration of the backup side
Install rsync software, ditto
To set a password file, simply fill in the corresponding password:
# touch/usr/local/rsync/web1 # touch/usr/local/rsync/web2 # vi/usr/local/rsync/web1 [email protected] # Vi/usr/loc AL/RSYNC/WEB2 [email protected]
Also set to only Root has permission
# chmod 600/USR/LOCAL/RSYNC/WBE1
Create a backup directory
# mkdir-p/usr/local/web1 # mkdir-p/USR/LOCAL/WEB2 # Rsync–daemon
Back up the server-side file Web1 to the native (backup machine):
#/USR/BIN/RSYNC-VZRTOPG--progress--delete--exclude "logs/"--exclude "conf/ssl.*/"--password-file=/usr/local/ rsync/web1 [Email Protected]::web1/usr/local/web1
# WEB2 is the same as above manual synchronization
--delete means that if the server side deletes this file, then the client will also delete the file accordingly, maintain the true consistency, delete the local directory of redundant files
--Exclude "logs/" means that the files in the/web1/logs directory are not backed up.
--exclude "conf/ssl.*/" means that the files in the/web1/conf/ssl.*/directory are not backed up.
If needed can be placed in the Crontab scheduled task in the interval of the synchronous backup!
Write the above command to a scheduled task and execute it every 1 minutes to achieve the effect of real-time synchronization.
Note:
Above this command line in the-VZRTOPG V is verbose,z is compressed, R is Recursive,topg is to keep the original properties of the file, such as owner, time parameters. --progress is to show the detailed progress,--delete is that if the server side delete the file, then the client will also delete the file, maintain true consistency.
Attached, frequently asked questions when using rsync:
Error 1:rsync:read error:connection reset by Peer (104)
Rsync Error:error in Rsync protocol data Stream (code) at IO.C (794) [receiver=3.0.2]
Workaround: It is possible that the Rsync service is not turned on on the server side. Turn on the service. or the port specified by the firewall is not reachable.
Error 2: @ERROR: ChDir failed
Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1495) [receiver=3.0.2]
FIX: Server-side synchronization 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 in server-side profile rsyncd.conf to resolve.
Error 4: @ERROR: Invalid UID Nobody
Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1506) [receiver=3.0.2]
Workaround: Add the following two lines to the rsyncd.conf file to resolve the issue
UID = 0
GID = 0
Error 5: @ERROR: Auth failed on module test2
Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1296) [receiver=3.0.2]
Workaround: The server does not specify the correct secrets file, please add the following configuration line in the [test2] configuration segment:
Auth users = Coldstar #同步使用的帐号
Secrets file = Rsyncd.secrets #密码文件
Error 6:password file must not being other-accessible
Resolution: The client's pass file requires permission for chmod 600/etc/rsync.pass.
Transfer from http://www.cnblogs.com/keheng/p/3800734.html
Using Rsync for multi-server file synchronization under Linux