-
Type: Question
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: 4.2.10
-
Component/s: Replication, Stability, Usability
-
None
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