美文网首页
mongodb 集群关闭

mongodb 集群关闭

作者: adonisjph | 来源:发表于2016-11-14 10:59 被阅读867次

    本地用三台机器部署了mongo集群,需要测试能否切换primary和secondary。
    于是在关闭primary的时候出现了以下问题:

    repset:PRIMARY> use admin
    switched to db admin
    repset:PRIMARY> db.shutdownServer()
    2016-11-14T10:07:51.912+0800 E QUERY    [thread1] Error: shutdownServer failed: {
        "ok" : 0,
        "errmsg" : "shutdown must run from localhost when running db without auth",
        "code" : 13
    } :
    _getErrorWithCode@src/mongo/shell/utils.js:25:13
    DB.prototype.shutdownServer@src/mongo/shell/db.js:302:1
    @(shell):1:1
    
    

    解决方法

    [grid@mongohost1 mongodb2.6]$ ./bin/mongo --port 33333
    MongoDB shell version: 2.6.10
    connecting to: 127.0.0.1:33333/test
    > use admin
    switched to db admin
    > db.shutdownServer()
    2015-09-09T09:57:30.453+0800 DBClientCursor::init call() failed
    server should be down...
    2015-09-09T09:57:30.458+0800 trying reconnect to 127.0.0.1:33333 (127.0.0.1) failed
    2015-09-09T09:57:30.458+0800 warning: Failed to connect to 127.0.0.1:33333, reason: errno:111 Connection refused
    2015-09-09T09:57:30.459+0800 reconnect 127.0.0.1:33333 (127.0.0.1) failed failed couldn't connect to server 127.0.0.1:33333 (127.0.0.1), connection attempt failed
    

    相关文章

      网友评论

          本文标题:mongodb 集群关闭

          本文链接:https://www.haomeiwen.com/subject/vbrhpttx.html