1. 启动命令  
  2. 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 &  
  3. 启动  
  4. 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 &  
  5. 停止  
  6. /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  
  7.   
  8. 从库启动  
  9. 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 &  
  10.   
  11. 停止  
  12. /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  
  13. 访问mongo  
  14. /home/sh/local/mongodb-linux-x86_64-rhel62-3.4.0/bin/mongo  
  15.   
  16.   
  17. Error: error: {  
  18.         "ok" : 0,  
  19.         "errmsg" : "not master and slaveOk=false",  
  20.         "code" : 13435,  
  21.         "codeName" : "NotMasterNoSlaveOk"  
  22. }  
  23. db.getMongo().setSlaveOk();  #启动slave
  24.   
  25.   
  26. 查看服务状态  
  27. db.printReplicationInfo();  
  28.   
  29.   
  30. 杀掉服务  
  31. kill -3 `ps -ef|grep mongod|grep -v grep|awk '{print $2}'`  
  32.   
  33. slaveok=ok  
  34.   
  35. wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel62-3.4.0.tgz 

相关文章:

  • 2021-11-17
  • 2021-12-09
  • 2022-12-23
  • 2021-07-05
  • 2021-11-17
  • 2021-11-17
  • 2022-02-25
  • 2021-08-06
猜你喜欢
  • 2022-02-11
  • 2022-12-23
  • 2021-11-24
  • 2022-12-23
  • 2021-09-25
  • 2021-11-27
  • 2022-12-23
相关资源
相似解决方案