mongodb中master宕机时如何自动运行slave?
我的主站和从站
在不同的端口上运行。但是当我关闭master
时,slave也会宕机
。我明白为什么会发生这种情况。我希望当主服务器宕机时,从服务器成为新的主服务器,而无需使用 --master 选项重新启动 mongod。我的 mongodb 连接从未中断
。
I have master and slave
running on different port. But when I close master
the slave goes down
too. I understand why this is happening. I want that when master goes down the slave become a new master without restarting the mongod with --master
option. And My mongodb connection never got down
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要使用replicaSet系统而不是MongoDB中的Master/Slave系统。
有关复制集的所有文档都位于 MongoDB wiki 上: http://www.mongodb.org/display /DOCS/副本+集
You need use the replicaSet system instead of the Master/Slave system in MongoDB.
all documentation about Replicat Set is on MongoDB wiki : http://www.mongodb.org/display/DOCS/Replica+Sets