mongodb主從複製,命令很是簡單:mongodb
主服務器:
服務器
/usr/local/mongodb/bin/mongod --logpath=/usr/local/mongodb/dblogs --dbpath=/usr/local/mongodb/data/ --fork --port=27017 --master
blog
從服務器:
ast
/usr/local/mongodb/bin/mongod --logpath=/usr/local/mongodb/dblogs_1 --dbpath=/usr/local/mongodb/data_1/ --fork --port=27018 --slave --source localhost:27017db
/usr/local/mongodb/bin/mongod --logpath=/usr/local/mongodb/dblogs_2 --dbpath=/usr/local/mongodb/data_2/ --fork --port=27019 --slave --source localhost:27017mongod
/usr/local/mongodb/bin/mongod --logpath=/usr/local/mongodb/dblogs_3 --dbpath=/usr/local/mongodb/data_3/ --fork --port=27020 --slave --source localhost:27017主從複製