How to force a delayed member to become primary in case of failure in mongodb I have three member set [primary,secondary &amp; arbiter] in my data center 1 [DC1]. Now i want a delayed member in data center 2 [DR]. In case DC 1 is completely down then my sub net application pointed will be redirected to DR. In that case :

a. How i will use DR mongodb as its a delayed member.

b. When the DC come back online then how i will sync the database from DR to DC.
Firstly, it is not recommended to have a replica set with even number of members. Hence, it will be better to add an arbiter or another data bearing node in the DC2

Coming to your question, the DR servers are not supposed to be used for ensuring availability they are meant to provide limited functionality during recovery from a disaster. Assuming the configuration that you have provided:

a.) How i will use DR mongodb as its a delayed member.

For your configuration assuming 1 vote per server, the majority will be 3. If DC1 goes down then no server will be able to get majority votes. Hence there will be no primary. Thus for the duration of the downtime your application will be able to service only read requests for the time up-to which the data has been synched on the delayed node.

b. When the DC come back online then how i will sync the database from DR to DC.

Since the application is in read only mode, hence once the DC1 comes up, there will be a primary election and server in DC1 with the latest data will be elected primary and the server in DC2 will be relegated to the secondary and the replication would take care of the synch