The configuration process is documented to prevent forgetting! If the proposed technical support QQ group 139785720 configuration structure is as follows:
I. Installation steps (server-side 192.168.0.5)
1) Install rsync click Download rsync-3.0.9.tar.gz
Download files to the directory/usr/src
#cd/USR/SRC
#tar-zxvf rsync-3.0.9.tar.gz/Extract Files
#cd rsync-3.0.9//Enter the file directory
#./configure//Primary role is to configure the software that is about to be installed to check whether the current environment meets the dependencies of the software to be installed
#make//Compilation
#make Install//installation
2) installation inotify Click to download inotify-tools-3.14.tar.gz
Download files to the directory/usr/src
#cd/USR/SRC
#tar-zxvf inotify-tools-3.14.tar.gz/Extract Files
#cd inotify-tools-3.14//Enter the file directory
#./configure//Primary role is to configure the software that is about to be installed to check whether the current environment meets the dependencies of the software to be installed
#make//Compilation
#make Install//installation
3 server-side writing folder monitoring scripts
#vi/srv/rsync.sh
Rsync.sh contents are as follows:
#!/bin/bash
src=/srv/test/#监视改文件路径, folder content changes trigger server data synchronization
Des=backup #客服端配置的模块 (customer service side will introduce)
Host= "192.168.10.6" #同步到的IP地址, if multiple spaces are separated. For example: host= "192.168.10.6 192.168.10.7"
/usr/local/bin/inotifywait-mrq--timefmt '%d/%m/%y%h:%m '--format '%T%w%f '-e modify,delete,create,attrib $SRC | While read files #这边要主要下inotifywait, only the Linux 2.6.13 or higher version will be compatible
Todo
For HostIP in $host
Todo
#rsync-vzrtopg--delete--progress rsync@ $hostip:: $des $src--password-file=/etc/rsync.pas This command is to sync to server side with new post
RSYNC-VZRTOPG--delete--progress--password-file=/etc/rsync.pas $src rsync@ $hostip:: $des # Change the command is the server side with the new sync to the customer service side (see the specific use of the choice)
#--password-file=/etc/rsync.pas Configuration to the customer service side, that is, the client path has RSYNC.PAS to configure the login password
#rsync is the login name for the client configuration
Done
echo "${files} was rsynced" >>/tmp/rsync.log 2>&1 #生成日志文件
Done
4) Start Nohup
#nohup/bin/bash/srv/rsync.sh &//Background not hung up to run the command
#echo "Nohup/bin/bash/root/bin/rsync.sh &" >>/etc/rc.local//Set up Linux Server start automatic start nohup
rsync + inofity Server is configured, next we will configure the customer service side
Two. Installation Steps (customer service side)
1) Install rsync steps as above!
2) Configure rsyncd.conf
#vi/etc/rsyncd.conf//Open rsyncd.conf
rsyncd.conf contents are as follows:
UID = root
GID = root
Port = 873 #post rsync is used with the end number is also the default port number
hosts allow = 192.168.10.5 ; #allow hosts IP-promised IP access can also be set to IP segment
max connections =
timeout=
# #config file
pid file =/var/run/rsyncd.pid
Lock file =/var/run/rsync.lock< br> log file =/var/log/rsyncd.log
#motd file =/ETC/RSYNCD.MOTD
# #global config
[Backup]
Path =/srv/test #客服端已rsync服务端同步的文件路径
comment = from 192.168.10.5 #解释
Read only = no
list = no
# #client sync config
auth users =rsync #配置登陆名称
Secrets F ile =/etc/rsync.passwd #配置用户名密码文件
3) Configure RSYNC.PASSWD
#vi/etc/rsync.passwd
RSYNC.PASSWD contents are as follows:
RSYNC:CYC #rsync登陆用户名 Cyc is the login code.
#chomd rsync.passwd #需要注意rsync. passwd Permissions Configuration
Customer service end configuration complete!
Three. If the following problems occur in the reconfiguration process, analyze the cause of the error.
Question one:
@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 two:
@ERROR: Auth failed on module backup
Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1522) [receiver=3.0.3]
Reason:
The server side of this module (backup) needs to authenticate the username password, but the client does not provide the correct username password, authentication failed.
Provide the correct username password to resolve this issue.
Question three:
@ERROR: Unknown module ' backup '
Rsync Error:error starting Client-server Protocol (code 5) at MAIN.C (1522) [receiver=3.0.3]
Reason:
The specified module does not exist for the server. Provide the correct module name or modify the server side to the module you want to solve the problem.