"Go" CentOS5.6 Configure rsync Intranet synchronization data to the external network
This article transferred from: http://www.linuxidc.com/Linux/2012-06/64070.htm
First, the demand
Guard there is a demand, is to put an intranet server data synchronization to a server outside the network, I used to be RSYNC+INTIFY-TOOL+SSH implementation of real-time synchronization updates, the other day I was in Dongguan on business, the development of the people call me to say that the two server data is not synchronized, I went up to check again, the original is used to synchronize the data of this system account was modified by Beijing colleagues, SSH password failed to login, so the data can not be synchronized, and then think of this in the system open a single user to synchronize the data is indeed a security risk, I have specific and development of communication a bit, The data synchronization of this project is not so need real-time synchronization, so now I want to change to the rsync synchronization alone, the following steps:
Second, the environment
Intranet: 10.20.220.247
Synchronizing Directory 1:/data/appsdata/softmgr-v3/static-file/update
Synchronizing Directory 2:/data/appsdata/softmgr-v3/static-file/v1_0
External network: 114.112.36.X
Synchronizing Directory 1:/data/apps/ksoftmgr/ksafe/client/update
Synchronizing Directory 2:/data/apps/ksoftmgr/ksafe/client/v1_0
Three, installation configuration
1. Server-side (114.112.36.69)
A, [[email protected] ~]# yum-y install rsync xinetd
B, [[email protected] ~]# Vi/etc/xinetd.d/rsync
Change disable = No to Yes
[[email protected] ~]#/etc/init.d/xinetd start
C, write the rsync configuration file http://www.linuxidc.com
[Email protected] ~]# vi/etc/rsyncd.conf
UID = root
GID = root
Use chroot = no
Max connections = 10
Strict modes = yes
PID file =/var/run/rsyncd.pid
Lock file =/var/run/rsync.lock
Log file =/var/log/rsyncd.log
[UPDATE]
Path =/data/apps/ksoftmgr/ksafe/client/update
Comment = update file
Ignore errors
Read Only = no
Write only = no
Hosts allow = 125.89.65.194
Hosts deny = *
UID = root
Auth users = WCM
Secrets file =/etc/web.pass
[V1_0]
Path =/data/apps/ksoftmgr/ksafe/client/v1_0
Comment = V1_0 file
Ignore errors
Read Only = no
Write only = no
Hosts allow = 125.89.65.194
Hosts deny = *
UID = root
Auth users = WCM
Secrets file =/etc/web.pass
D. Write the password file
[[email protected] ~]# vi/etc/web.pass (format account: password)
wcm:8888888
[Email protected] ~]# chown Root:root/etc/web.pass
[Email protected] ~]# chmod 600/etc/web.pass
E. Start rsync
[Email protected] ~]# rsync--daemon
[Email protected] ~]# echo "rsync--daemon" >>/etc/rc.local
2. Client (10.20.220.247)
A, [[email protected] ~]# yum-y install rsync
B. Write the password file
[[email protected] ~]# Vi/etc/web.pass (main: Write only the password used to sync the account)
8888888
[Email protected] ~]# chown Root:root/etc/web.pass
[Email protected] ~]# chmod 600/etc/web.pass
C, write crontab, not one minute synchronization
[Email protected] v1_0]# CRONTAB-E
*/1 * * * */USR/BIN/RSYNC-AVZ--progress--delete/data/appsdata/softmgr-v3/static-file/update/[email protected]: : Update--password-file=/etc/web.pass
*/1 * * * */USR/BIN/RSYNC-AVZ--progress--delete/data/appsdata/softmgr-v3/static-file/v1_0/[email protected]::v1_ 0--password-file=/etc/web.pass
Iv. Testing
In the intranet update and V1_0 to delete or create a new file, to see if the corresponding external network of the machine is also doing the corresponding operation, if it is, explain OK, my affirmation is Satan, the line of the different steps on the tragedy.
"Go" CentOS5.6 Configure rsync Intranet synchronization data to the external network