Skip to content

wzdnzd/bidirectional-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bi-Directional-Sync

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.

Install Packages

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 

Clone and Config

Note: Use dos2unix reformat all files

vim /etc/lsyncd/config.json

Params:

  • 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
  • ...

Access without Requiring a Password

ssh-keygen -t rsa
ssh-copy-id root@target

Execute Lsyncd

  • 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

Reference

About

Near real-time bi-directional synchronization tool base on lsyncd

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published