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.

最新文章

  1. Centos——安装JDK
  2. RN8209校正软件开发心得(1)
  3. 使用Autolayout对多行文本Label进行布局,高度不准确的解决办法!
  4. wcf,jquery,post,跨域
  5. thinkphp新增
  6. hibernate杂记
  7. [转载]vs2012中使用Spring.NET报错:Spring.Context.Support.ContextRegistry 的类型初始值设定项引发异常
  8. HTML Meta, http-equiv, Refresh
  9. Ethernet & IEEE 802.3 802.X 802.1ag-MEP
  10. Service Lane
  11. AngularJS中serivce,factory,provider的区别
  12. CentOS服务器下对mysql的优化
  13. Android多线程.断点续传下载
  14. LINUX服务器--所有用户登陆操作命令审计
  15. FusionWidgets Cylinder图
  16. [Swift]LeetCode5. 最长回文子串 | Longest Palindromic Substring
  17. Linux系统一些常用命令(持续增加)
  18. python3 集合set
  19. 使用google guava做内存缓存
  20. Struts2中的ModelDriven接口

热门文章

  1. javascript第三节
  2. Java微信公众平台开发(十四)【番外篇】--微信web开发者工具使用
  3. java5 Condition用法--实现线程间的通信
  4. json和pickle序列化模块
  5. 设置窗口的z-order总是在最底部
  6. lucene 第二天
  7. 1、 Shiro框架:认证,授权(验权 2. Shiro框架实现权限控制方式:
  8. 23、sed常用命令
  9. Yii2邮箱发送与配置
  10. jquery遮罩层