views:

16

answers:

1

I am working on a project where I want to have the ability to specify that certain nodes of the replica set can never be primary nodes ie in case of a failure where all primary capable nodes die the system should be reduced to a read-only state till some primary capable node comes up. Is this possible? If yes how? If not what is the best way around it.

+1  A: 

This is from the documentation (emphasis mine):

priority - priority a server has for potential election as primary. The highest priority member which is up will become primary. Default 1.0. Priority zero means server can never be primary.

So setting the priority to zero should achieve what you want.

Niels van der Rest
Thanks! I ran some tests and that's correct!
Ankur Chauhan
Can I run queries against priority zero node? If yes how?
Ankur Chauhan
@Ankur Chauhan: Sure, just connect to the node and query it. If it gives you a "not master" error, call `rs.slaveOk()` to allow queries on slave nodes.
Niels van der Rest