Hi there!
I have a strange problem.
I’m trying initiate replicaset from standalone.
At first:
i’m running three mongo servers with configuration:
replication:
replSetName: "rs0"
At second:
On primary node i’m running:
rs.initiate()
At third:
On primary node i’m running:
rs.add({host:"mongo-second"})
and i got
uncaught exception: Error: assert failed : error: local.system.replset has unexpected contents :
doassert@src/mongo/shell/assert.js:20:14
assert@src/mongo/shell/assert.js:151:9
rs.add/<@src/mongo/shell/utils.js:1636:9
assert.soon@src/mongo/shell/assert.js:366:21
rs.add@src/mongo/shell/utils.js:1632:5
@(shell):1:1
If i check local db
{ "_id" : "rs0", "version" : 1, "term" : 1, "members" : [ { "_id" : 0, "host" : "127.0.0.1:27017", "arbiterOnly" : false, "buildIndexes" : true, "hidden" : false, "priority" : 1, "tags" : { }, "secondaryDelaySecs" : NumberLong(0), "votes" : 1 } ], "protocolVersion" : NumberLong(1), "writeConcernMajorityJournalDefault" : true, "settings" : { "chainingAllowed" : true, "heartbeatIntervalMillis" : 2000, "heartbeatTimeoutSecs" : 10, "electionTimeoutMillis" : 10000, "catchUpTimeoutMillis" : -1, "catchUpTakeoverDelayMillis" : 30000, "getLastErrorModes" : { }, "getLastErrorDefaults" : { "w" : 1, "wtimeout" : 0 }, "replicaSetId" : ObjectId("62f505145f0ed792fa58b7fa") } }
I’m trying to delete this
use local
db.system.replset.remove({});
and runed inizialization again and i get same error
help me please)
mongo version - 5.0.9
UPD: instead mongo i tried using mongosh and that worked for me. Why did that work?