how to convert secondary node as a primary node if the primary node is down?

267 views
Skip to first unread message

Fraj KALLEL

unread,
Apr 21, 2014, 9:12:40 AM4/21/14
to mongod...@googlegroups.com

Hello,

I have mongodb replication with 2 nodes, I stop the high availability by changing the priority for the 2 nodes:

master priority = 2

slave priority = 0

master vote = 2.

I’d like to know how to convert secondary node as a primary node if the primary node is down?

Thanks

Asya Kamsky

unread,
Apr 21, 2014, 7:17:38 PM4/21/14
to mongodb-user
First of all, you should change vote on "master" back to 1 (which is the default so the votes field won't show up then when you look at the config - and that's okay).

If you have failure of your primary, you would need to connect to the secondary and manually reconfigure the replica set to remove master and change priority of secondary back to 1.   Alternatively you can set priority of master to 0 as you change priority of secondary to 1.

Because you will be doing this configuration on the secondary, you will need to do 'rs.reconfig(newconfig, {force:true}) to indicate that you are deliberately doing a reconfiguration of a replica set from a secondary - normally you should do it from the primary, then you will not need the force flag.

Note that I'm assuming you are using primary and secondary replica sets, not the old obsolete master/slave configuration.

Asya



--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/fd846e7a-ecf5-4fcd-8471-64341fd0ad71%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages