mongodb中master宕机时如何自动运行slave?

发布于 2024-10-09 23:20:48 字数 186 浏览 0 评论 0原文

我的主站和从站在不同的端口上运行。但是当我关闭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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蓝海似她心 2024-10-16 23:20:48

您需要使用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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文