DBAtlas · Database operations atlas

Change member priority

MongoDBReplica Set

Command

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

What it does

Changes the specified member's priority for becoming primary in elections.

When to use it

When you want a specific node to be the preferred primary.

Caution

reconfig can trigger an election and cause a brief primary change/write outage.

Open in DBAtlas →

Related