文檔地址:https://github.com/Qihoo360/mongosync/wiki/%E4%BD%BF%E7%94%A8%E6%A0%B7%E4%BE%8Bc++
#數據全量備份
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/git
安裝mongosync
yum install gcc-c++ scons
yum install boost boost-devel boost-doc
yum install openssl-devel
cd mongosync && makegithub
一、帶索引實時同步
/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 --oplogrest