Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to change priority in 3 nodes cluster #1639

Open
balait4 opened this issue Nov 20, 2024 · 0 comments
Open

How to change priority in 3 nodes cluster #1639

balait4 opened this issue Nov 20, 2024 · 0 comments

Comments

@balait4
Copy link

balait4 commented Nov 20, 2024

I have 3 member cluster (6.0.6) and I want to set or give more priority for 2 members and less for one member.
I tried setting automationConfig which is not working. Also I had set under memberConfig which is not working.

automationConfig:
    replicaSet:
      settings:
        members:
          - _id: 0
            host: mongodb-i-srv-0.mongodb-i-srv.mongodb-i.svc.cluster.local:27017
            priority: 2
          - _id: 1
            host: mongodb-i-srv-1.mongodb-i-srv.mongodb-i.svc.cluster.local:27017
            priority: 2
          - _id: 2
            host: mongodb-i-srv-2.mongodb-i-srv.mongodb-i.svc.cluster.local:27017
            priority: 1
        electionTimeoutMillis: 10000
    processes:
          - name: mongodb-i-srv-0
            hostname: mongodb-i-srv-0.mongodb-i-srv.mongodb-i.svc.cluster.local
            processType: mongod
            version: "6.0.6"
            disabled: false
            args:
              net:
                port: 27017
              replication:
                replSetName: mongodb-i-srv
          - name: mongodb-i-srv-1
            hostname: mongodb-i-srv-1.mongodb-i-srv.mongodb-i.svc.cluster.local
            processType: mongod
            version: "6.0.6"
            disabled: false
            args:
              net:
                port: 27017
              replication:
                replSetName: mongodb-i-srv
          - name: mongodb-i-srv-2
            hostname: mongodb-i-srv-2.mongodb-i-srv.mongodb-i.svc.cluster.local
            processType: mongod
            version: "6.0.6"
            disabled: false
            args:
              net:
                port: 27017
              replication:
                replSetName: mongodb-i-srv
type: ReplicaSet
memberConfig:
  - priority: '2'
    votes: 1
  - priority: '2'
    votes: 1
  - priority: '1'
    votes: 1

When I tried setting this manually as well its getting revert immediately.

cfg = rs.conf()
cfg.members[0].priority = 5
cfg.members[1].priority = 5
cfg.members[2].priority = 2
rs.reconfig(cfg)

mongodb-configs.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant