Installation
Rsync-3.1.0.tar.gz
#tar ZXVF rsync-3.1.0.tar.gz
#cd rsync-3.1.0
#./configure--prefix=/home/work/rsync
#make
#make Install
The configuration of Rsync server;
Environment: 192.168.11.11 for production machine; 192.168.11.12 for backup machine;
Then need to 192.168.11.11 as the client of rsync;
192.168.11.12 as the service side of rsync;
1, 192.168.11.12_service end of the configuration;
1) [Root@cmmailapp2 data]# touch/etc/rsyncd.conf//This file is the main configuration problem for rsync, the default does not exist need to be manually created;
2) Define the configuration of synchronization;
[Root@cmmailapp2 data]# cat/etc/rsyncd.conf
[Data]
Path =/data/
Auth users = Coremail
UID = root
GID = root
Secrets file =/etc/rsyncd.secrets
Read Only = no
[MySQL]
Path =/home/coremail/var/mysql
Auth users = Coremail
UID = root
GID = root
Secrets file =/etc/rsyncd.secrets
Read Only = no
[CMXT]
Path =/home/coremail/
Auth users = Coremail
UID = root
GID = root
Secrets file =/etc/rsyncd.secrets
Read Only = no
3) define password file/etc/rsyncd.secrets
[Root@cmmailapp2 data]# Cat/etc/rsyncd.secrets
Coremail:coremail
4 Start rsync start service
[Root@cmmailapp2 data]# Cat/etc/xinetd.d/rsync
# Default:off
# description:the Rsync server is a good addition to a FTP server, as it
# allows CRC Checksumming etc.
Service rsync
{
Disable = yes//need to be modified to no;
Socket_type = Stream
wait = no
user = root
Server =/usr/bin/rsync
Server_args =--daemon
Log_on_failure + + USERID
}
[Root@cmmailapp2 data]# chkconfig--level 2345 rsync on
[Root@cmmailapp2 data]# chkconfig rsync on
[Root@cmmailapp2 data]# chkconfig--level 2345 xinetd on
[ROOT@CMMAILAPP2 data]# Service xinetd restart
stopping xinetd: [OK]
Starting xinetd: [OK]
2, 192.168.11.11_client end of the configuration;
[Root@cmmailapp1/]# Cat/etc/rsyncd.secrets
Coremail
[Root@cmmailapp1/]# RSYNC-ASVH--password-file=/etc/rsyncd.secrets/home/coremail/coremail@192.168.11.12::d ata
[Root@cmmailapp1/]# RSYNC-ASVH--password-file=/etc/rsyncd.secrets/home/coremail/coremail@192.168.11.12::mysql
[Root@cmmailapp1/]# RSYNC-ASVH--PASSWORD-FILE=/ETC/RSYNCD.SECRETS/HOME/COREMAIL/COREMAIL@192.168.11.12::CMXT
Define timed self-rsync synchronization, specify the path of the synchronized log under/var/log/rsync/;
[Root@cmmailapp1 log]# cat/root/rsync.sh
Date= ' Date +%y%m%d%h%m '
RSYNC-ASVH--password-file=/etc/rsyncd.secrets/home/coremail/coremail@192.168.11.12::d ata >/var/log/ Rsync.date. $DATE
RSYNC-ASVH--password-file=/etc/rsyncd.secrets/home/coremail/coremail@192.168.11.12::mysql >/var/log/ Rsync.mysql. $DATE
RSYNC-ASVH--PASSWORD-FILE=/ETC/RSYNCD.SECRETS/HOME/COREMAIL/COREMAIL@192.168.11.12::CMXT >/var/log/ Rsync.cmxt. $DATE
chmod u+x/root/rsync.sh
[Root@cmmailapp1 log]# Crontab-l
0 3 * * */root/rsync.sh
Day of the execution time record file:
[Root@cmmailapp1 log]# ls |grep ' rsync '
rsync.cmxt.201110180915
rsync.date.201110180915
rsync.mysql.201110180915
Start
rsync--daemon--port 3334--config=/home/work/rsync/conf/rsyncd.conf
Error 1
@ERROR: Setgroups failed
Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1503) [sender=3.0.6]
This error I was due to the service of rsync and the transmission of the rsync version without. It would be nice to replace it with a version later.
PS Everyone should pay attention to a point when the Rsync software is a server-side and the client two kinds, that is, the master-slave server, so the installation version is not the same OH.