2019独角兽企业重金招聘Python工程师标准>>>

今天在使用mongoDB时,使用以下命令,想看一下集合的时候:

SECONDARY> show collections

报了下面的错:

2017-03-08T17:15:31.037+0800 E QUERY    [thread1] Error: listCollections failed: { "ok" : 0, "errmsg" : "not master and slaveOk=false", "code" : 13435 } :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DB.prototype._getCollectionInfosCommand@src/mongo/shell/db.js:773:1
DB.prototype.getCollectionInfos@src/mongo/shell/db.js:785:19
DB.prototype.getCollectionNames@src/mongo/shell/db.js:796:16
shellHelper.show@src/mongo/shell/utils.js:754:9
shellHelper@src/mongo/shell/utils.js:651:15
@(shellhelp2):1:1

重点是这句:

"errmsg" : "not master and slaveOk=false"

拿去百度了一下,发现这是一个正常的情况,由于读写分离,SECONDARY不允许读写的,所以会报这个ERROR。

如果偏要解决的话,执行下面的命令:

SECONDARY> rs.slaveOk();

OK~~~

转载于:https://my.oschina.net/lonelycode/blog/854398

mongoDB Error:not master and slaveOk=false相关推荐

  1. 【MongoDB】MongoDb的“not master and slaveok=false”错误及解决方法

    链接mongodb报错如下 2016-03-14T16:26:00.912+0800 E QUERY [thread1] Error: listDatabases failed:{ "ok& ...

  2. “errmsg“ : “not master and slaveOk=false“_Mongo集群没有primary但有secondary时连接不上且不能读数据

    短暂解决方法 ## 第一种方法 db.getMongo().setSlaveOk(); ## 第二种方法 rs.slaveOk(); 之所以短暂是因为下次再通过mongo进入实例的时候,查询仍然会报错 ...

  3. Git:错误:error:src refspec master does not match any

    新建立了一个远程仓库,想着把项目放上去.于是在项目目录上: git init 然后就添加远程库 git remote add origin xxxx.git 然后就想push: git push -u ...

  4. git 解决push报错:[rejected] master -> master (fetch first) error: failed to push some refs to

    git 解决push报错:[rejected] master -> master (fetch first) error: failed to push some refs to </h1 ...

  5. 本地文件上传到GitLab 以及问题:! [rejected] master -」 master (fetch first) error: failed to push some refs to

    在本地创建git仓库 cd 本地项目目录 $ git init 将本地项目加入到GitLab中 $ git remote add origin "远程地址" 加入本地文件(后面的点 ...

  6. eclipse链接Hadoop集群时报错Error:Call From xxx/xxx.xxx.xxx.xxx to hostname1:9000 failed on connection excep

    今天用eclipse连接Hadoop集群的时候突然给我报了这样一个错误:Error:Call From xxx/xxx.xxx.xxx.xxx to hostname1:9000 failed on ...

  7. Command failed with error 10107: ‘not master‘ on server 10.2.2.139:27017. Closed connection

    springboot 连接mogodb,报错Command failed with error 10107: 'not master' on server Closed connection [con ...

  8. python连接mongodb进行查询_Python中的MongoDB基本操作:连接、查询实例

    MongoDB是一个基于分布式文件存储的数据库.由C++语言编写.旨在为WEB应用提供可护展的高性能数据存储解决方案.它的特点是高性能.易部署.易使用,存储数据非常方便. MongoDB 简单使用 联 ...

  9. mongoDB研究笔记:分片集群的工作机制

    上面的(http://www.cnblogs.com/guoyuanwei/p/3565088.html)介绍了部署了一个默认的分片集群,对mongoDB的分片集群有了大概的认识,到目前为止我们还没有 ...

最新文章

  1. catia 如何提取cgr面_CATIA 创成式外形设计精品课程
  2. arm开发板放张图片动起来_ARM裸机不能正确显示图片的问题
  3. leetcode 385. Mini Parser | 385. 迷你语法分析器(Java)
  4. 数据可视化的基本原理——视觉通道
  5. 2019无盘游戏服务器128g内存,云更新无盘客户端 v2019.8.15.12486官方版
  6. homebrew卡在:Updating Homebrew处
  7. Android:QQ登录页面
  8. UIDynamic(物理仿真)
  9. DEM数字高程数据之高程网格格式转换
  10. linux系统 安装qq教程视频,LinuxQQ教程 LumaQQ的安装和使用详细介绍
  11. 论文总结(3):Intelligent Traffic Monitoring Systems for Vehicle Classification: A Survey
  12. 怎样使用Excel填充柄的作用与功能
  13. 菜菜的sklearn课堂——决策树
  14. HTTP请求头headers
  15. 【渗透测试笔记】之【MSF 信息搜集】
  16. 2016年农民工监测调查报告(zz)
  17. 这38款超级炫酷的时间轴特效代码案例,总有一款是你需要的
  18. 第三届中医药文化传承与技能发展大会召开助推中医药文化传承创新
  19. Android实现弹出窗口(PopUpWindow)
  20. UML—机房收费系统

热门文章

  1. 电脑耗电知多少及如何节能
  2. [article]回忆录的开始
  3. ASP.NET取用户浏览器IP地址等信息
  4. 组件与.NET互操作
  5. MVC利用Routing实现多域名绑定一个站点、二级域名以及二级域名注册Area
  6. Windows 7操作系统优化
  7. 【073】Android 数据存储(SQLite)
  8. 解决路由环路问题的探讨
  9. 常用工具——Rsync
  10. Linux自学笔记——iptables