[SERVER-55580] MongoDB Replicaset Restart issues in Kubernetes Created: 27/Mar/21  Updated: 29/Mar/21  Resolved: 29/Mar/21

Status: Closed
Project: Core Server
Component/s: Replication, Stability, Usability
Affects Version/s: 4.2.10
Fix Version/s: None

Type: Question Priority: Major - P3
Reporter: Devender Singh Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

Hi

 

I have deployed 3 nodes Replicaset of MongoDB 4.2 on kubernetes (as a statefulset). There is 1 Primary (mongodb-0 first node) and 2 secondaries (mongodb-1 and mongodb-2).

 

In the rs.config - I have given priority 1 to primary (mongodb-0) and 0 to secondaries (mongodb-1/2). after the configuration things works well with the application and no issue in mongo as well.

 

But when we shutdown the env. (shutdown the kubernetes nodes) OR whenever we need to restart the statefulset - post restart - mongodb-0 that was primary doesnt remain as primary instead sometimes its comes as "Other" and sometimes "Secondary" - our application doesnt work when mongodb-0 is not primary. 

 

Please advise if there is someway that can help to avoid getting mongodb-0 loosing its primary replica state ? We need mongodb-0 to maintain its state even when replicaset is restarted.

 

Please let me know incase you need any more details.

 

Thank you,

-Devender 



 Comments   
Comment by Eric Sedor [ 29/Mar/21 ]

Hi itsdevtiamo@gmail.com,

The SERVER project is for bugs and feature suggestions for the MongoDB server. For this issue we'd like to encourage you to start by asking our community for help by posting on the MongoDB Developer Community Forums.

Briefly I would suggest you look into or ask about making a "replica set connection" so that the app can function no matter which node is Primary.

Eric

Generated at Thu Feb 08 05:36:52 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.