mongodb 集群关闭

本地用三台机器部署了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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 135,156评论 19 139
  • Spring Boot 参考指南 介绍 转载自:https://www.gitbook.com/book/qbgb...
    毛宇鹏阅读 46,993评论 6 342
  • 本次学习使用的是麦子学院的《mongodb最佳实践课程》.侵删. 安装数据库 在ubuntu下mongodb默认已...
    whaike阅读 1,413评论 1 6
  • 从明日开始,做一个自知的人 看书\散步\写作\听歌\打球 创造一...
    住我心里阅读 109评论 0 0
  • 1、感恩父母给予我生命。 2、感恩祖辈将我养育。 3、感恩母亲、祖母为家的巨大付出。 4、感恩亲友们对我家的照顾。...
    朱晓军阅读 119评论 0 0