count failed: not master{ "note" : "from execCommand", "ok" : 0, "errmsg" : "not master" } at src/mongo/shell/query.js:191在SECONDARY节点无法show dbs
2024-08-25 03:44:40
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.
最新文章
- Centos——安装JDK
- RN8209校正软件开发心得(1)
- 使用Autolayout对多行文本Label进行布局,高度不准确的解决办法!
- wcf,jquery,post,跨域
- thinkphp新增
- hibernate杂记
- [转载]vs2012中使用Spring.NET报错:Spring.Context.Support.ContextRegistry 的类型初始值设定项引发异常
- HTML Meta, http-equiv, Refresh
- Ethernet &; IEEE 802.3 802.X 802.1ag-MEP
- Service Lane
- AngularJS中serivce,factory,provider的区别
- CentOS服务器下对mysql的优化
- Android多线程.断点续传下载
- LINUX服务器--所有用户登陆操作命令审计
- FusionWidgets Cylinder图
- [Swift]LeetCode5. 最长回文子串 | Longest Palindromic Substring
- Linux系统一些常用命令(持续增加)
- python3 集合set
- 使用google guava做内存缓存
- Struts2中的ModelDriven接口