mongo 实时同步工具 mongosync

文档地址:https://github.com/Qihoo360/mongosync/wiki/%E4%BD%BF%E7%94%A8%E6%A0%B7%E4%BE%8B

#数据全量备份
mongodump --authenticationDatabase admin -u root -p root  --port 27017-h 192.168.10.125 -o /opt/mongo-backup/
#数据全量恢复
#staging
mongorestore -h 192.168.10.123:27017--authenticationDatabase admin -u root -p root --dir /opt/mongo-backup/


安装mongosync
yum install gcc-c++ scons
yum install boost boost-devel boost-doc
yum install openssl-devel
cd mongosync && make

1、带索引实时同步
/opt/server/mongosync/output/mongosync --src_srv 192.168.10.125:27017--src_user root --src_passwd root --src_auth_db admin --dst_srv 192.168.10.123:27017--dst_user root --dst_passwd root --dst_auth_db admin --bg_num 2 --oplog

原文地址:https://www.cnblogs.com/cp-miao/p/8568010.html