Configure the file synchronization server as a synchronization service for other servers
1. Install xinetd first.
Yum-y install xinetd
2. Rsync is generally installed by default.
3. Run Vim/etc/xinetd. conf to change disable = yes to disable = No.
3. Vim/etc/rsyncd. conf (note that this file is not available, just write it directly)
# Rsync
Uid = nobody
Gid = nobody
Max connections = 4
Use chroot = No
Log File =/var/log/rsyncd. Log
PID file =/var/run/rsyncd. PID
Lock file =/var/run/rsyncd. Lock
# Auth users = root
Hosts allow = 192.168.1.3/6
# Hosts deny = 192.168.100.0/24
[Default]
Path =/usr/tomcat6/webapps/tkpcms/published/default/
Comment = deployment WWW
Ignore errors
Read Only = Yes
List = No
Hosts allow = 192.168.1.3/6
Auth users = default
Secrets file =/etc/rsyncd. pwd
Description
[Module name]
Path = backup file path
Auth users = authorized account
Uid = uid at execution time
Gid = GID at execution time
Secrets file = Password File Location
Read Only = read-only or not
4. Create a verification file
Echo default: XXX>/etc/rsyncd. pwd
Chmod 600/etc/rsyncd. pwd
5. Start the service
Rsync-daemon
6. Echo "rsync-daemon">/etc/rc. d/rc. Local # add it to the self-starting File
7. The service uses port 873 by default. Therefore, you must add an open port in iptables.
Vim/etc/sysconfig/iptables
8. Add
-A RH-Firewall-1-INPUT-M state -- state new-m tcp-p tcp -- dport 873-J accept
9. Service iptables restart
10. Check whether the listener is enabled.
Netstat-Na | grep 873
The output is
TCP 0 0 0.0.0.0: 873 0.0.0.0: * listen
TCP 0 0: 873: * listen
Ii. Client Configuration
1. Echo XXX>/etc/rsyncd. pwd # rsync server Postfix password (Note: as long as the password is used)
2, rsync-avuz-delete default@192.168.1.4: default/data/www/-- password-file =/etc/rsyncd. pwd
Test passed to prove service availability
3. crontab-e # Add a scheduled synchronization task.
From: http://blackhost.iteye.com/blog/831893