https://github.com/wzdnzd/bidirectional-sync
Near real-time bi-directional synchronization tool base on lsyncd
https://github.com/wzdnzd/bidirectional-sync
backup lsyncd lua rsync synchronization
Last synced: about 1 year ago
JSON representation
Near real-time bi-directional synchronization tool base on lsyncd
- Host: GitHub
- URL: https://github.com/wzdnzd/bidirectional-sync
- Owner: wzdnzd
- License: apache-2.0
- Created: 2019-04-12T08:45:12.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-15T09:42:07.000Z (about 7 years ago)
- Last Synced: 2025-02-17T03:28:52.992Z (over 1 year ago)
- Topics: backup, lsyncd, lua, rsync, synchronization
- Language: Lua
- Homepage: https://github.com/wzdnzd/bidirectional-sync
- Size: 25.4 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## 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](https://github.com/axkibe/lsyncd). The sync direction control by DNS from master to slave.
### Install Packages
- [lsyncd](https://centos.pkgs.org/7/epel-x86_64/lsyncd-2.2.2-1.el7.x86_64.rpm.html)
- [lua-socket](https://centos.pkgs.org/7/epel-x86_64/lua-socket-3.0-0.17.rc1.el7.x86_64.rpm.html)
```bash
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
```bash
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
```bash
ssh-keygen -t rsa
ssh-copy-id root@target
```
### Execute Lsyncd
+ start with utils/lsyncd-cli.sh
```bash
./utils/lsyncd-cli.sh start
```
+ start with systemctl
```bash
# 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
+ [lsyncd实时同步搭建指南](http://seanlook.com/2015/05/06/lsyncd-synchronize-realtime/)
+ [lsyncd](http://axkibe.github.io/lsyncd/)