I. requirement guard has a requirement to synchronize data from an intranet server to a server on the Internet, previously, I used real-time synchronization updates implemented by rsync + in‑tool + ssh. I was on a business trip in Dongguan a few days ago, the developer called me and said that the data on the two servers was not synchronized. I went up and checked it again. The system account used to synchronize data was changed by my colleagues in Beijing, ssh password-free login failed, so the data cannot be synchronized. later I thought it would be true to have a single user on the system for data synchronization.
I. requirements
The guard has a requirement to synchronize data from an intranet server to an Internet server. Previously, I used rsync + InSync-tool + ssh for real-time synchronization updates, I was on a business trip in Dongguan a few days ago. the developer called me and said that the data on the two servers was not synchronized. I went up and checked it again, the system account used to synchronize data was modified by colleagues in Beijing. ssh password-free login failed, so data cannot be synchronized, later, I thought that there was indeed a security risk when a single user was opened in the system to synchronize data. I had a specific communication with developers, and the data synchronization of this project was not so necessary to be synchronized in real time, so now I want to use rsync for single synchronization. the specific steps are as follows:
II. environment
Intranet: 10.20.220.247
Synchronization directory 1:/data/Dynamic data/softmgr-v3/static-file/update
Synchronization directory 2:/data/Dynamic data/softmgr-v3/static-file/v1_0
Internet: 114.112.36.X
Synchronization directory 1:/data/apps/ksoftmgr/ksafe/client/update
Synchronization directory 2:/data/apps/ksoftmgr/ksafe/client/v1_0
III. installation and configuration
1. server (114.112.36.69)
A. [root @ localhost ~] # Yum-y install rsync xinetd
B. [root @ localhost ~] # Vi/etc/xinetd. d/rsync
Change disable = no to yes
[Root @ localhost ~] #/Etc/init. d/xinetd start
C. write The rsync configuration file
[Root @ localhost ~] # 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 a password file
[Root @ localhost ~] # Vi/etc/web. pass (format account: password)
Wcm: 8888888
[Root @ localhost ~] # Chown root: root/etc/web. pass
[Root @ localhost ~] # Chmod 600/etc/web. pass
E. start rsync.
[Root @ localhost ~] # Rsync -- daemon
[Root @ localhost ~] # Echo "rsync -- daemon">/etc/rc. local
2. client (10.20.220.247)
A. [root @ localhost ~] # Yum-y install rsync
B. write a password file
[Root @ localhost ~] # Vi/etc/web. pass (mainly: write the password of the account used for synchronization only)
8888888
[Root @ localhost ~] # Chown root: root/etc/web. pass
[Root @ localhost ~] # Chmod 600/etc/web. pass
C. write a crontab and synchronize it once every minute.
[Root @ localhost v1_0] # crontab-e
*/1 ***/usr/bin/rsync-avz -- progress -- delete/data/parse data/softmgr-v3/static-file/update/wcm@114.112.36.x :: update -- password-file =/etc/web. pass
*/1 */usr/bin/rsync-avz -- progress -- delete/data/parse data/softmgr-v3/static-file/v1_0/wcm@114.112.36.X :: v1_0 -- password-file =/etc/web. pass
IV. test
Delete or create a file under intranet update and v1_0 to check whether the corresponding operation is performed on the machine on the Internet. If yes, it means OK. I must scatter it, online Non-synchronization is a tragedy.