Mongo DB - All secondary nodes

All nodes in our cluster are "secondary", and node increases as "primary".

How to make node become the main one?

=== Solution === We had 4 nodes in our replica set when we should only have an odd number of nodes.

  • Remove node so you have an odd number of nodes

    • rs.config ()

    Edit the list of servers in notepad / text panel by deleting one of the servers

    • config = POST_MODIFIED_LIST_HERE

    • rs.reconfig (config, {force: true})

  • Stop the mongodb mongod service on all nodes and return them

  • Done

If this does not fix, try adding priority to one of the nodes.

+7
source share
2 answers

You can use the following instructions on the MongoDB website:

http://www.mongodb.org/display/DOCS/Forcing+a+Member+to+be+Primary

+2
source

If you have an even number of nodes, one of them is to delete it. Another answer may be to add an arbiter who does not have a copy of the data, but participates in the cluster solely for voting and breaking ties. Thus, you get odd vote numbers and guaranteed choices, but the availability / capacity of the four nodes.

+1
source

All Articles