zoukankan      html  css  js  c++  java
  • count failed: not master{ "note" : "from execCommand", "ok" : 0, "errmsg" : "not master" } at src/mongo/shell/query.js:191在SECONDARY节点无法show dbs

    count failed: not master{ "note" : "from execCommand", "ok" : 0, "errmsg" : "not master" } at src/mongo/shell/query.js:191

    在SECONDARY节点无法show dbs

    主从启动之后,连接slave可以成功连上,但是在slave中执行 show dbs 的时候就报错了:

    QUERY Error: listDatabases failed:{ "note" : "from execCommand", "ok" : 0, "errmsg" : "not master" }
    解决方法:

    在报错的slave机器上执行 rs.slaveOk()方法即可。

    解释一下具体slaveOk方法是什么意思?

    Provides a shorthand for the following operation:

    db.getMongo().setSlaveOk()
    This allows the current connection to allow read operations to run on secondary members. See the readPref() method for more fine-grained control over read preference in the mongo shell.

  • 相关阅读:
    我的期末可以加分项
    冲刺
    公司授课管理系统
    挑战赛题终于完成
    Java web 学习
    Java web 学习
    Javaweb 学习
    Base64加密
    选课系统
    Educational Codeforces Round 62题解
  • 原文地址:https://www.cnblogs.com/OnlyDreams/p/7590432.html
Copyright © 2011-2022 走看看