Cause: |
The apt update may have changed the Primary DB Node unintentionally.
This can be seen when running rs.status() from the Mongo Shell.
replica1 [direct: secondary] test> rs0:PRIMARY> rs.status();
ReferenceError: PRIMARY is not defined
replica1 [direct: secondary] test> rs.status
[Function: status] AsyncFunction {
apiVersions: [ 0, 0 ],
returnsPromise: true,
serverVersions: [ '0.0.0', '999.999.999' ],
topologies: [ 'ReplSet', 'Sharded', 'LoadBalanced', 'Standalone' ],
returnType: { type: 'unknown', attributes: {} },
deprecated: false,
platforms: [ 'Compass', 'Browser', 'CLI' ],
isDirectShellCommand: false,
acceptsRawInput: false,
shellCommandCompleter: undefined,
help: [Function (anonymous)] Help
}
replica1 [direct: secondary] test> rs.status();
{
set: 'replica1',
date: ISODate('2024-12-12T12:33:27.256Z'),
myState: 2,
term: Long('17'),
syncSourceHost: 'mdb3:27017',
syncSourceId: 2,
heartbeatIntervalMillis: Long('2000'),
majorityVoteCount: 2,
writeMajorityCount: 2,
votingMembersCount: 3,
writableVotingMembersCount: 3,
optimes: {
lastCommittedOpTime: { ts: Timestamp({ t: 1734006803, i: 1 }), t: Long('17') },
lastCommittedWallTime: ISODate('2024-12-12T12:33:23.680Z'),
readConcernMajorityOpTime: { ts: Timestamp({ t: 1734006803, i: 1 }), t: Long('17') },
appliedOpTime: { ts: Timestamp({ t: 1734006803, i: 1 }), t: Long('17') },
durableOpTime: { ts: Timestamp({ t: 1734006803, i: 1 }), t: Long('17') },
lastAppliedWallTime: ISODate('2024-12-12T12:33:23.680Z'),
lastDurableWallTime: ISODate('2024-12-12T12:33:23.680Z')
},
lastStableRecoveryTimestamp: Timestamp({ t: 1734006783, i: 1 }),
members: [
{
_id: 0,
name: '10.10.100.51:27017',
health: 1,
state: 2,
stateStr: 'SECONDARY',
uptime: 72070,
optime: { ts: Timestamp({ t: 1734006803, i: 1 }), t: Long('17') },
optimeDate: ISODate('2024-12-12T12:33:23.000Z'),
lastAppliedWallTime: ISODate('2024-12-12T12:33:23.680Z'),
lastDurableWallTime: ISODate('2024-12-12T12:33:23.680Z'),
syncSourceHost: 'mdb3:27017',
syncSourceId: 2,
infoMessage: '',
configVersion: 5,
configTerm: 17,
self: true,
lastHeartbeatMessage: ''
},
{
_id: 1,
name: 'mdb2:27017',
health: 1,
state: 1,
stateStr: 'PRIMARY',
uptime: 72061,
optime: { ts: Timestamp({ t: 1734006803, i: 1 }), t: Long('17') },
optimeDurable: { ts: Timestamp({ t: 1734006803, i: 1 }), t: Long('17') },
optimeDate: ISODate('2024-12-12T12:33:23.000Z'),
optimeDurableDate: ISODate('2024-12-12T12:33:23.000Z'),
lastAppliedWallTime: ISODate('2024-12-12T12:33:23.680Z'),
lastDurableWallTime: ISODate('2024-12-12T12:33:23.680Z'),
lastHeartbeat: ISODate('2024-12-12T12:33:25.391Z'),
lastHeartbeatRecv: ISODate('2024-12-12T12:33:26.970Z'),
pingMs: Long('0'),
lastHeartbeatMessage: '',
syncSourceHost: '',
syncSourceId: -1,
infoMessage: '',
electionTime: Timestamp({ t: 1733934731, i: 1 }),
electionDate: ISODate('2024-12-11T16:32:11.000Z'),
configVersion: 5,
configTerm: 17
},
{
_id: 2,
name: 'mdb3:27017',
health: 1,
state: 2,
stateStr: 'SECONDARY',
uptime: 72061,
optime: { ts: Timestamp({ t: 1734006803, i: 1 }), t: Long('17') },
optimeDurable: { ts: Timestamp({ t: 1734006803, i: 1 }), t: Long('17') },
optimeDate: ISODate('2024-12-12T12:33:23.000Z'),
optimeDurableDate: ISODate('2024-12-12T12:33:23.000Z'),
lastAppliedWallTime: ISODate('2024-12-12T12:33:23.680Z'),
lastDurableWallTime: ISODate('2024-12-12T12:33:23.680Z'),
lastHeartbeat: ISODate('2024-12-12T12:33:25.390Z'),
lastHeartbeatRecv: ISODate('2024-12-12T12:33:26.970Z'),
pingMs: Long('0'),
lastHeartbeatMessage: '',
syncSourceHost: 'mdb2:27017',
syncSourceId: 1,
infoMessage: '',
configVersion: 5,
configTerm: 17
}
],
ok: 1,
'$clusterTime': {
clusterTime: Timestamp({ t: 1734006803, i: 1 }),
signature: {
hash: Binary.createFromBase64('pe4F/9YaIdiw7Pj+r8fu/epNh04=', 0),
keyId: Long('7412554116225826818')
}
},
operationTime: Timestamp({ t: 1734006803, i: 1 })
}
replica1 [direct: secondary] test> rs0:PRIMARY
ReferenceError: PRIMARY is not defined
replica1 [direct: secondary] test>
In this case ID 0 should be the Primary but ID 1 has this instead.
|