Promote secondary to primary from secondary node

柔情痞子 提交于 2019-12-05 00:16:19

问题


My test system (due to lack of resources) has a dual mongodb replicaset. There is no arbiter.

During some system changes one of the servers got put out of action and will not be coming back. This server happened to host the primary mongo node. This left the only other member of the set as a secondary.

I know I should have had at least three nodes for the cluster (our prod setup does).

Is there a way I can make the primary that is now offline to step down? I haven't been able to change any of the rs.conf() settings because the only working node is secondary. starting an arbiter doesn't seem to work because I cannot add it to the replset as the primary is down.

Has anyone encountered this before and managed to resolve it?

To recap:

SERVER A (PRIMARY) - OFFLINE

SERVER B (SECONDARY) - ONLINE

A + B = REPLSET

Any help would be greatly appreciated.


回答1:


The mongodb website has documentation for what to do (in an emergency only) when you need to reconfigure a replica set when members are down. This sounds like the situation you are in.

Basically, if you're on version >= 2.0, and it's an emergency, you can add force: true to the replica set configuration command.



来源:https://stackoverflow.com/questions/9632156/promote-secondary-to-primary-from-secondary-node

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!