|
Posted on
2017-01-10 14:10
moss_tan_jun
阅读( 356)
评论()
编辑
收藏
举报
- 启动命令
- nohup /home/sh/local/mongodb-linux-x86_64-rhel62-3.4.0/bin/mongod -dbpath /home/sh/local/mongodb-linux-x86_64-rhel62-3.4.0/db &
- 启动
- nohup /home/sh/local/mongodb-linux-x86_64-rhel62-3.4.0/bin/mongod --config /home/sh/local/mongodb-linux-x86_64-rhel62-3.4.0/bin/mongodb.conf -master &
- 停止
- /home/sh/local/mongodb-linux-x86_64-rhel62-3.4.0/bin/mongod --shutdown -dbpath /home/sh/local/mongodb-linux-x86_64-rhel62-3.4.0/db
-
- 从库启动
- nohup /home/sh/local/mongodb-linux-x86_64-rhel62-3.4.0/bin/mongod --config /home/sh/local/mongodb-linux-x86_64-rhel62-3.4.0/bin/mongodb.conf -slave -source 192.168.1.130:27017 &
-
- 停止
- /home/sh/local/mongodb-linux-x86_64-rhel62-3.4.0/bin/mongod --shutdown -dbpath /home/sh/local/mongodb-linux-x86_64-rhel62-3.4.0/db
- 访问mongo
- /home/sh/local/mongodb-linux-x86_64-rhel62-3.4.0/bin/mongo
-
-
- Error: error: {
- "ok" : 0,
- "errmsg" : "not master and slaveOk=false",
- "code" : 13435,
- "codeName" : "NotMasterNoSlaveOk"
- }
- db.getMongo().setSlaveOk(); #启动slave
-
-
- 查看服务状态
- db.printReplicationInfo();
-
-
- 杀掉服务
- kill -3 `ps -ef|grep mongod|grep -v grep|awk '{print $2}'`
-
- slaveok=ok
-
- wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel62-3.4.0.tgz
|