patternMinor
Force a Member to Become Primary in mongodb
Viewed 0 times
forceprimarymongodbmemberbecome
Problem
I looked into answers but nothing works for me in mongo 2.6.11 cluster 'nms' (members nms01m and nms02) below. I want my current secondary nms01m to become primary, and now nms02 is primary instead of nms02 (after nms01m failure last night). I tried stopping nsm02, restarting nms01m , changing priority, rs.reconfig(cfg, {force : true}) but nothing helps. It is always a struggle for me
nms:SECONDARY> rs.conf()
{
"_id" : "nms",
"version" : 193970,
"members" : [
{
"_id" : 0,
"host" : "nms02:27017",
"priority" : 2
},
{
"_id" : 1,
"host" : "nms01m:27017"
}
]
}Solution
The reason
According to the documentation:
Specify higher values to make a member more eligible to become primary, and lower values to make the member less eligible.
snip
A priority of 0 makes it impossible for a member to become primary.
nms02 becomes Primary when it joins the replicaset is due to having the higher priority setting.According to the documentation:
Specify higher values to make a member more eligible to become primary, and lower values to make the member less eligible.
snip
A priority of 0 makes it impossible for a member to become primary.
Context
StackExchange Database Administrators Q#123944, answer score: 4
Revisions (0)
No revisions yet.