Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-55580

MongoDB Replicaset Restart issues in Kubernetes

    • Type: Icon: Question Question
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.2.10
    • 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 

            Assignee:
            Unassigned Unassigned
            Reporter:
            itsdevtiamo@gmail.com Devender Singh
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: