Scopul meu este migrarea datelor prin replicare de la un set de replica mongodb la un alt set de replica mongodb.
Încerc să migrez datele de la replicaset a (pe cluster kubernetes a) la replicaset b (pe kubernetes cluster b)
Vezi mai jos încercarea mea:
bitnami/mongodb helm chart https://github.com/bitnami/charts/tree/master/bitnami/mongodb
global:
namespaceOverride: mongodb
arhitectura: replicaset
auth:
rootPassword: „<redactat>”
replicaSetKey: „aceeași valoare”
Număr de replici: 1
serviceCont:
crea: adevărat
rbac:
crea: adevărat
persistenţă:
storageClass: „mongodb”
dimensiune: 250 Gi
acces extern:
activat: adevărat
AutoDiscovery:
activat: adevărat
Pași
- Creați replicaset A pe cluster Kubernetes A
- Creați replicaset B pe clusterul Kubernetes B
- Adăugați un membru din replicaset B la replicaset A utilizând comanda
rs.add( { gazdă: „<gazdă>:27017”, prioritate: 0, voturi: 0} )
membrul nu reușește să se alăture
rs0 [direct: primar] admin> rs.status()
{
setați: „rs0”,
data: ISODate("2022-05-26T09:03:03.196Z"),
myState: 1,
termen: lung ("3"),
syncSourceHost: '',
syncSourceId: -1,
heartbeatIntervalMillis: Long ("2000"),
majority VoteCount: 2,
writeMajorityCount: 1,
votingMembersCount: 2,
writableVotingMembersCount: 1,
optime: {
lastCommittedOpTime: { ts: Timestamp({ t: 1653555782, i: 1 }), t: Long("3") },
lastCommittedWallTime: ISODate("2022-05-26T09:03:02.147Z"),
readConcernMajorityOpTime: { ts: Timestamp({ t: 1653555782, i: 1 }), t: Long("3") },
applyOpTime: { ts: Timestamp({ t: 1653555782, i: 1 }), t: Long("3") },
durabilOpTime: { ts: Timp({ t: 1653555782, i: 1 }), t: Long("3") },
lastAppliedWallTime: ISODate("2022-05-26T09:03:02.147Z"),
lastDurableWallTime: ISODate("2022-05-26T09:03:02.147Z")
},
lastStableRecoveryTimestamp: timestamp ({ t: 1653555762, i: 1 }),
electionCandidateMetrics: {
lastElectionReason: „electionTimeout”,
lastElectionDate: ISODate("2022-05-26T08:59:02.135Z"),
electionTerm: Long ("3"),
lastCommittedOpTimeAtElection: { ts: Timestamp({ t: 1653555514, i: 1 }), t: Long("2") },
lastSeenOpTimeAtElection: { ts: Timestamp({ t: 1653555514, i: 1 }), t: Long("2") },
numVotesNeeded: 2,
priorityAtElection: 5,
electionTimeoutMillis: Long ("10000"),
numCatchUpOps: Long ("0"),
newTermStartDate: ISODate("2022-05-26T08:59:02.141Z"),
wMajorityWriteAvailabilityDate: ISODate("2022-05-26T08:59:02.142Z")
},
membri: [
{
_id: 0,
nume: „<redacted_a>:27017”,
sanatate: 1,
stare: 1,
stateStr: „PRIMAR”,
timp de funcționare: 167634,
optime: { ts: Timestamp({ t: 1653555782, i: 1 }), t: Long("3") },
optimeDate: ISODate("2022-05-26T09:03:02.000Z"),
lastAppliedWallTime: ISODate("2022-05-26T09:03:02.147Z"),
lastDurableWallTime: ISODate("2022-05-26T09:03:02.147Z"),
syncSourceHost: '',
syncSourceId: -1,
infoMesaj: '',
electionTime: timestamp({ t: 1653555542, i: 1 }),
electionDate: ISODate("2022-05-26T08:59:02.000Z"),
configVersion: 5,
configTerm: 3,
sine: adevărat,
lastHeartbeatMessage: ''
},
{
_id: 1,
nume: „mongodb-prod-arbiter-0.mongodb-prod-arbiter-headless.mongodb.svc.cluster.local:27017”,
sanatate: 1,
stare: 7,
stateStr: „ARBITER”,
timp de funcționare: 250,
lastHeartbeat: ISODate("2022-05-26T09:03:01.611Z"),
lastHeartbeatRecv: ISODate("2022-05-26T09:03:01.691Z"),
pingMs: Long ("0"),
lastHeartbeatMessage: '',
syncSourceHost: '',
syncSourceId: -1,
infoMesaj: '',
configVersion: 5,
configTerm: 3
},
{
_id: 2,
nume: „<redacted_b>”,
sănătate: 0,
stare: 8,
stateStr: „(nu este accesibil/sănătos)”,
timp de funcționare: 0,
optime: { ts: Timestamp({ t: 0, i: 0 }), t: Long("-1") },
optimeDurable: { ts: Timestamp({ t: 0, i: 0 }), t: Long("-1") },
optimeDate: ISODate("1970-01-01T00:00:00.000Z"),
optimeDurableDate: ISODate("1970-01-01T00:00:00.000Z"),
lastAppliedWallTime: ISODate("1970-01-01T00:00:00.000Z"),
lastDurableWallTime: ISODate("1970-01-01T00:00:00.000Z"),
lastHeartbeat: ISODate("2022-05-26T09:03:01.719Z"),
lastHeartbeatRecv: ISODate("1970-01-01T00:00:00.000Z"),
pingMs: Long ("0"),
lastHeartbeatMessage: „ID-urile setului de replici nu se potrivesc, ale noastre: 628cb373d4eda0a12d1a75e0; nodurile la distanță: 628f3e9b4d975fb84fc5a5b1”,
syncSourceHost: '',
syncSourceId: -1,
infoMesaj: '',
configVersion: -1,
configTerm: -1
}
],
ok: 1,
„$clusterTime”: {
clusterTime: timestamp({ t: 1653555782, i: 1 }),
semnătură: {
hash: binar(Buffer.from ("cf0cde3a5498d190d7258912ea99822796fda70f", "hex"), 0),
ID cheie: Long("7101248018959040517")
}
},
Operațiune: Timp ({ t: 1653555782, i: 1 })
}
{"t":{"$date":"2022-05-26T09:07:22.362+00:00"},"s":"I", "c":"REPL_HB", "id":23974, "ctx":"ReplCoord-4","msg":"Bătaia inimii a eșuat după un număr maxim de încercări","attr":{"target":"<redacted_b>","maxHeartbeatRetries":2,"error":{"code ":93,"codeName":"InvalidReplicaSetConfig","errmsg":"ID-urile setului de replici nu se potrivesc, ale noastre: 628cb373d4eda0a12d1a75e0; nodurile la distanță: 628f3e9b4d975fb84fc5}}}