Note:
- requires rsync >= 3.1 on all source and target machines
Real-time bi-directional synchronization tools between two data centers base on lsyncd. The sync direction control by DNS from master to slave.
yum install -y rsync
rpm -ivh https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/l/lsyncd-2.2.2-1.el7.x86_64.rpm
rpm -ivh https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/l/lua-socket-3.0-0.17.rc1.el7.x86_64.rpm Note: Use dos2unix reformat all files
vim /etc/lsyncd/config.jsonParams:
- host: target server
- delete: whether to allow deletion when synchronizing
- script: the path of shell script
- excludeFrom: list of files that need to be excluded
- port: ssh port
- bwlimit: bandwidth limit
- ...
ssh-keygen -t rsa
ssh-copy-id root@target- start with utils/lsyncd-cli.sh
./utils/lsyncd-cli.sh start- start with systemctl
# modify 'LSYNCD_OPTIONS' point to the conf/bisync.conf.lua
vim /etc/sysconfig/lsyncd
# enable auto startup when boosting
systemctl enable lsyncd
# start
systemctl start lsyncd