I did a small change with rs.reconfig which caused my primary node being stuck in RECOVERING state. How can I correct this?
I just changed protocolVersion: Long("0") from protocolVersion: Long("1") with the following command:
rs.reconfig({
_id: 'x',
version: 803461,
protocolVersion: Long("0"),
members: [
{
_id: 1,
host: '10.x.0.x:27017',
arbiterOnly: false,
buildIndexes: true,
hidden: false,
priority: 1,
tags: {},
slaveDelay: Long("0"),
votes: 1
},
{
_id: 2,
host: '10.x.0.x:27017',
arbiterOnly: false,
buildIndexes: true,
hidden: false,
priority: 1,
tags: {},
slaveDelay: Long("0"),
votes: 1
}
],
settings: {
chainingAllowed: true,
heartbeatIntervalMillis: 2000,
heartbeatTimeoutSecs: 10,
electionTimeoutMillis: 10000,
catchUpTimeoutMillis: 60000,
getLastErrorModes: {},
getLastErrorDefaults: { w: 1, wtimeout: 0 },
replicaSetId: ObjectId("5a884c37b6ccb139231011c9")
}
})
The node which was previously primary one
{
_id: 1,
name: '10.x.0.x:27017',
health: 1,
state: 3,
stateStr: 'RECOVERING',
uptime: 804,
optime: [Object],
optimeDate: 2021-12-24T16:39:05.000Z,
infoMessage: 'could not find member to sync from',
configVersion: 803465,
self: true
}
CodePudding user response:
Only protocol version 1 is supported in MongoDB 4.0 .
If you have manually configured an unsupported version, you can change it back using rs.reconfig with the force:true
option