Diagram:
Rsync Version
[Root@mail video]# Rsync–version
Rsync version 3.0.6 protocol version 30
Copyright (C) 1996-2009 by Andrew Tridgell, Wayne Davison, and others.
Web site:rsync.samba.org
Capabilities:
64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints,
Socketpairs, Hardlinks, symlinks, IPv6, Batchfiles, InPlace,
Append, ACLs, Xattrs, Iconv, no symtimes
Rsync comes with absolutely NO WARRANTY. This is free software, and
are welcome to redistribute it under certain conditions. The GNU
General public Licence for details.
Server Synchronization Task requirements
Server A synchronizes with Server B, which only indicates that server a synchronizes to Server B and Server B restores to server A.
Consider security factors and synchronize with ordinary users.
Using Cronjob, timed synchronization.
Error Tips
Error occurred in Rsync version 3.0.6, 64-bit CentOS5.5 system.
Home This article mainly solves the error is the following:
Copy Code code as follows:
@ERROR: Auth failed on module * * *
Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1503) [receiver=3.0.6]
Is the module that you configure in/etc/rsyncd.conf, I use here
Copy Code code as follows:
Password file must not is other-accessible
Continuing without password file
Password:
@ERROR: Auth failed on module * * *
Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1503) [receiver=3.0.6]
Rsync Configuration
#vi/etc/rsyncd.conf
Copy Code code as follows:
UID = nobody
GID = Nobody
Max connections = 4
Read Only = True
#hosts allow = 202.207.177.180
Hosts allow = *
Transfer logging = True
Log format =%h%o%f%l%b
Log file =/var/log/rsyncd.log
SLP Refresh = 300
Log file =/var/log/rsyncd.log
PID file =/var/run/rsyncd.pid
Lock file =/var/run/rsyncd.lock
[web]
Path =/home/admin/public_html
Comment = Mirror to Hk server
Read Only = True
List = False
Auth users = lixiphp
[Test]
Path =/home/admin/domains/test
Read Only = False
Auth users = lixiphp
Secrets file =/etc/rsyncd.secrets
Configure common user passwords
Copy Code code as follows:
[Root@mail video]# Vi/etc/rsyncd.secrets
Format is: Username:password
Copy Code code as follows:
Set permissions to read-only:
Copy Code code as follows:
chmod 600/etc/rsyncd.secrets
Start rsync for the first time
Copy Code code as follows:
Rsync–daemon–config=/etc/rsyncd.conf
If prompted
Copy Code code as follows:
Failed to create PID File/var/run/rsyncd.pid:file exists
Using directives
Rm-rf/var/run/rsyncd.pid
Reboot already running rsync
Copy Code code as follows:
[Root@mail video]# Ps-ef | grep rsync
Root 27284 1 0 10:26? 00:00:00 rsync–daemon–config=/etc/rsyncd.conf
Root 30516 29986 0 18:35 pts/3 00:00:00 grep rsync
[Root@mail video]# kill-9 27284
[Root@mail video]# rsync–daemon–config=/etc/rsyncd.conf
This makes the server a configuration successful!
Server B Configuration
General error will occur in Server B, pay attention to this part of the explanation!
Install Rsync services via CentOS yum install rsync.
After Rsync is installed, run the following instructions to synchronize the backup:
Copy Code code as follows:
Rsync-vzrtopg–progress–delete–password-file=/home/admin/admin_backups/password.rsync rsync:// Lixiphp@203.171.237.245/test/home/admin/admin_backups/test
Address rsync://lixiphp@203.171.237.245/test,lixiphp for Server a user, 203.171.237.245 server a IP address or domain name test for Server A configuration module
The password is stored in the/home/admin/admin_backups/password.rsync, where it is stored and freely arranged.
Password.rsync content format is: password
Copy Code code as follows:
Set permissions to read-only:
Copy Code code as follows:
chmod 600/home/admin/admin_backups/password.rsync
Resolve Errors
User Password Error
Copy Code code as follows:
@ERROR: Auth failed on module test
Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1503) [receiver=3.0.6]
Check that server a stores password files and Server B password files.
Server A password file/etc/rsyncd.secrets format is: Username:password
Server B password File password.rsync format is: password
File Permissions Error
Copy Code code as follows:
Password file must not is other-accessible
Continuing without password file
Password:
@ERROR: Auth failed on module * * *
Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1503) [receiver=3.0.6]
Check that server a stores password files and Server B password files.
Server A password file/etc/rsyncd.secrets permission is 600:chmod 600/etc/rsyncd.secrets
Server B password file password.rsync permissions for 600:chmod Password.rsync
timed Tasks
Copy Code code as follows:
[Root@hk admin_backups]# VI backup.sh
The contents are as follows:
Copy Code code as follows:
#/bin/sh
Rsync-vzrtopg–progress–delete–password-file=/home/admin/admin_backups/password.rsync rsync:// Lixiphp@203.171.237.245/test/home/admin/admin_backups/test
To add a timed task:
Copy Code code as follows:
[Root@hk admin_backups]# Crontab–e
Add the following:
Copy Code code as follows:
*/1 * * * */home/admin/admin_backups/backup.sh >/dev/null 2>&1
Sync every minute from server A to Server B!
Server B backs up to server A
Copy Code code as follows:
rsync-vzrtopg–progress–delete–password-file=/home/admin/admin_backups/password.rsync/home/admin/admin_backups/ Test Rsync://lixiphp@203.171.237.245/test
Make sure server a synchronizes user lixiphp with read, write, and execute permissions on the directory where the module test resides.