Hi, i’m trying to setup a replicat between 3 MongoDB instance in a Docker environnement. All instances of MongoDB seems to works well. I’m able to be connected to thoses instances with Compass. The replicat seems also to works, a primary is elected and nothing in the logs altert me of a potential problem.
Here is the rs.conf() output:
{
_id: 'rs0',
version: 1,
term: 3,
members: [
{
_id: 0,
host: 'mongo1:30001',
arbiterOnly: false,
buildIndexes: true,
hidden: false,
priority: 1,
tags: {},
secondaryDelaySecs: Long("0"),
votes: 1
},
{
_id: 1,
host: 'mongo2:30002',
arbiterOnly: false,
buildIndexes: true,
hidden: false,
priority: 1,
tags: {},
secondaryDelaySecs: Long("0"),
votes: 1
},
{
_id: 2,
host: 'mongo3:30003',
arbiterOnly: false,
buildIndexes: true,
hidden: false,
priority: 1,
tags: {},
secondaryDelaySecs: Long("0"),
votes: 1
}
],
protocolVersion: Long("1"),
writeConcernMajorityJournalDefault: true,
settings: {
chainingAllowed: true,
heartbeatIntervalMillis: 2000,
heartbeatTimeoutSecs: 10,
electionTimeoutMillis: 10000,
catchUpTimeoutMillis: -1,
catchUpTakeoverDelayMillis: 30000,
getLastErrorModes: {},
getLastErrorDefaults: { w: 1, wtimeout: 0 },
replicaSetId: ObjectId("646dd34139abd7f32bb09ea1")
}
}
And the rs.status():
{
set: 'rs0',
date: 2023-05-24T10:01:40.074Z,
myState: 2,
term: Long("3"),
syncSourceHost: 'mongo2:30002',
syncSourceId: 1,
heartbeatIntervalMillis: Long("2000"),
majorityVoteCount: 2,
writeMajorityCount: 2,
votingMembersCount: 3,
writableVotingMembersCount: 3,
optimes: {
lastCommittedOpTime: { ts: Timestamp({ t: 1684922497, i: 1 }), t: Long("3") },
lastCommittedWallTime: 2023-05-24T10:01:37.139Z,
readConcernMajorityOpTime: { ts: Timestamp({ t: 1684922497, i: 1 }), t: Long("3") },
appliedOpTime: { ts: Timestamp({ t: 1684922497, i: 1 }), t: Long("3") },
durableOpTime: { ts: Timestamp({ t: 1684922497, i: 1 }), t: Long("3") },
lastAppliedWallTime: 2023-05-24T10:01:37.139Z,
lastDurableWallTime: 2023-05-24T10:01:37.139Z
},
lastStableRecoveryTimestamp: Timestamp({ t: 1684922447, i: 1 }),
electionParticipantMetrics: {
votedForCandidate: true,
electionTerm: Long("3"),
lastVoteDate: 2023-05-24T09:30:57.058Z,
electionCandidateMemberId: 1,
voteReason: '',
lastAppliedOpTimeAtElection: { ts: Timestamp({ t: 1684920580, i: 1 }), t: Long("2") },
maxAppliedOpTimeInSet: { ts: Timestamp({ t: 1684920580, i: 1 }), t: Long("2") },
priorityAtElection: 1,
newTermStartDate: 2023-05-24T09:30:57.071Z,
newTermAppliedDate: 2023-05-24T09:30:57.349Z
},
members: [
{
_id: 0,
name: 'mongo1:30001',
health: 1,
state: 2,
stateStr: 'SECONDARY',
uptime: 1846,
optime: [Object],
optimeDurable: [Object],
optimeDate: 2023-05-24T10:01:37.000Z,
optimeDurableDate: 2023-05-24T10:01:37.000Z,
lastAppliedWallTime: 2023-05-24T10:01:37.139Z,
lastDurableWallTime: 2023-05-24T10:01:37.139Z,
lastHeartbeat: 2023-05-24T10:01:38.263Z,
lastHeartbeatRecv: 2023-05-24T10:01:38.266Z,
pingMs: Long("0"),
lastHeartbeatMessage: '',
syncSourceHost: 'mongo2:30002',
syncSourceId: 1,
infoMessage: '',
configVersion: 1,
configTerm: 3
},
{
_id: 1,
name: 'mongo2:30002',
health: 1,
state: 1,
stateStr: 'PRIMARY',
uptime: 1846,
optime: [Object],
optimeDurable: [Object],
optimeDate: 2023-05-24T10:01:37.000Z,
optimeDurableDate: 2023-05-24T10:01:37.000Z,
lastAppliedWallTime: 2023-05-24T10:01:37.139Z,
lastDurableWallTime: 2023-05-24T10:01:37.139Z,
lastHeartbeat: 2023-05-24T10:01:38.263Z,
lastHeartbeatRecv: 2023-05-24T10:01:39.779Z,
pingMs: Long("0"),
lastHeartbeatMessage: '',
syncSourceHost: '',
syncSourceId: -1,
infoMessage: '',
electionTime: Timestamp({ t: 1684920657, i: 1 }),
electionDate: 2023-05-24T09:30:57.000Z,
configVersion: 1,
configTerm: 3
},
{
_id: 2,
name: 'mongo3:30003',
health: 1,
state: 2,
stateStr: 'SECONDARY',
uptime: 1849,
optime: [Object],
optimeDate: 2023-05-24T10:01:37.000Z,
lastAppliedWallTime: 2023-05-24T10:01:37.139Z,
lastDurableWallTime: 2023-05-24T10:01:37.139Z,
syncSourceHost: 'mongo2:30002',
syncSourceId: 1,
infoMessage: '',
configVersion: 1,
configTerm: 3,
self: true,
lastHeartbeatMessage: ''
}
],
ok: 1,
'$clusterTime': {
clusterTime: Timestamp({ t: 1684922497, i: 1 }),
signature: {
hash: Binary(Buffer.from("71462de63bcd84a20b0fd37f9f8ecbeeeeff4646", "hex"), 0),
keyId: Long("7236672499625230342")
}
},
operationTime: Timestamp({ t: 1684922497, i: 1 })
}
I think i’m missing somethings in the initiatial parameters but i d’ont know what.
Any help will be useful.
Thanks,
Mallory LP.