Build the Rsync server architecture under centos6.x;
1. Install rsync
Yum Install-y rsync
2.rsync configuration file
Rsync server involves three configuration files: rsync.conf rsync.secrets RSYNC.MOTD
#创建配置文件目录; Mkdir/etc/rsyncd#rsync service general configuration file; Touch rsyncd.conf#rsync save user password file Touch rsync.secretschmod rsync.secrets# Rsync User Login Display information file Touch RSYNC.MOTD
3.rsync.conf
Cat/etc/rsyncd/rsyncd.conf
# minimal configuration file for rsync daemon# see rsync (1) and rsyncd.conf (5) man pages for help # this line is required by the /etc/init.d/rsyncd scriptpid file = /var/run/rsyncd.pid The IP behind the port = 873#addrss is the machine running rsync server ipaddress = 192.168.136.128 #uid = nobody#gid = nobody uid = root gid = root use chroot = yes read only = no #limit access to private lanshosts allow= 192.168.136.0/255.255.255.0 hosts deny=* #允许5个并发同时进行  MAX CONNECTIONS = 5MOTD file = /etc/rsyncd/rsyncd.motd #开启日志log file = /var/log/rsync.log # This will log every file transferred - up to 85,000+ per user, per sync# transfer logging = yes log format = %t %a %m %f % bsyslog facility = local3timeout = 300 [testhome] path = /home/test list=yesignore errorsauth users = testsecrets file = /etc/rsyncd/rsyncd.secrets comment = test home exclude = test/
4. Rsync.secrets
This is a password file that needs to be entered strictly in its format:
test:123456test2:654321
5.rsync.motd
This file is the user login to display the information, if not, you can comment out in the rsync.conf;
If you use, you can fill in it, there is no format limit;
6. Start the rsync server
/usr/bin/rsync--daemod--config=/etc/rsyncd/rsyncd.config# See if the process exists, if you don't see/var/log/rsync.log;iptablesps aux| grep rsync
Iptables need to add a 873 port, I test here, so I turned off the iptables;
7. Using on the client
Log on to other machines and use Rsync to sync from server to local;
/USR/BIN/RSYNC-AVZP--delete--password-file=rsyncd.password [email protected]::testhome/home/test
Note: 1.--delete indicates that remote and local data are consistent;
2.--password-file=rsync.password This parameter is a password-free mode, just need to put the test user password into rsync.passwd, such as: rsync.secrets test password is 123456, then echo " 123456 ">rsync.password can be, in addition, the permissions of this file also need 600;
3. Testhome is the [Testhome] module in the rsyncd.conf configuration file on the server side, if you want to change the path of synchronization, only need to modify the contents of its module;
4.test users are also on the server side of the Linux users, for security purposes, do not use the Linux password;
This article references: https://www.centos.bz/2011/06/rsync-server-setup/
This article from the "Shallow faint" blog, please be sure to keep this source http://cuixiang.blog.51cto.com/8204722/1769655
Rsync Server Setup