First, on the Web (Web install rsync does not need to configure rsyncd.conf), Web_bak install rsync (the Web updates the information under/var/www/html/, and then updates all data under the Wen_bak/var/www/html/)
ip:192.168.1.80 is the source server is the service side (Yum installs rsync on line, do not need to configure), 192.168.1.81 is the destination server is the client (Yum installs Rsync, also configures/etc/rsyncd.conf).
[email protected] ~]# yum-y Install rsync
Second, configure Web_bak rsync
[[Email protected]_bak]#vim/etc/rsyncd.conf ## Configuration files need to be created manually
# rsync
UID = nobody
GID = Nobody
Use chroot = no
Max connections = 10
PID file =/var/run/rsyncd.pid
Lock file =/var/run/rsyncd.lock
Log file =/var/run/rsyncd.log
[Web1]
Path =/var/www/html/(the client's path is not the same as the service side, self-determined)
Comment = Web_bak file
Ignore errors
Read Only = no
Write only = no
List = False
UID = root
GID = root
Auth users = root
Secrets file =/etc/rsyncd.pass
[[Email protected]_bak]#echo "root:123456" >/etc/rsyncd.pass
[[Email protected]_bak]#chown Root.root/etc/rsyncd.pass
[[Email protected]_bak]#chmod 600/etc/rsyncd.pass
Third, start rsync with the daemon and join the boot
[[Email protected]_bak]#rsync--daemon
[[Email protected]_bak]#PS aux | greprsync
Root 1344 0.1 0.0 107612 660? Ss 19:17 0:00 rsync--daemon
Root 1347 1.0 0.1 103240 864 pts/0 s+ 19:17 0:00 grep rsync
[[Email protected]_bak]#which rsync
/usr/bin/rsync
[[email protected]_bak]# echo " /usr/bin/rsync--daemon ">>/etc/rc.d/rc.local
[[email protected]_bak]# iptables-i input-p tcp--dport 873-j ACCEPT
[email protected]_bak]# service iptables Save
[[email protected]_bak]# Service iptables restart
[[email protected] ~]# echo "123456" >/etc/rsyncd.pass # Note there is no user password in the password file, the format is different from Web_bak
[[email protected] ~]# chown root.root/etc/rsyncd.pass
[[email protected] ~]# chmod 600/ Etc/rsyncd.pass
On the source server, run the test :
Pull from server side (180)
/usr/bin/rsync-avz--progress--password-file=/etc/rsync.pass [email protected]::test/www/test
Web server Push
/usr/bin/rsync-avz--progress--password-file=/etc/rsync.pass/www/test [email protected]::test
This article is from the "System website Operations" blog, please be sure to keep this source http://cgc888.blog.51cto.com/3989433/1717544
Rsync intranet server Push and pull public network code configuration