The mongodb-atlas-local image stores the replica set information in the /data/db
volume. However, each time the container is restarted, it regenerates a replica set config instead of reading the old one and reusing it. This causes a configuration error that prevents the instance from functioning normally.
Steps to reproduce:
- Run a mongodb-atlas-local container (bound to /data/db and /data/configdb)
- Make note of the replica set id via
rs.config()
or a similar command - Terminate the docker instance.
- Rerun mongodb-atlas-local
- Get the error
Locally stored replica set configuration does not have a valid entry for the current node; waiting for reconfig or remote heartbeat
The node will be unable to elect a primary as a result and eventually terminate.
The originally generated config set name in this case was “e78f2c1395b4”
[W] REPL ReplCoord-0 Locally stored replica set configuration does not have a valid entry for the current node; waiting for reconfig or remote heartbeat {"error":{"code":74,"codeName":"NodeNotFound","errmsg":"No host described in new configuration with {version: 1, term: 2} for replica set e78f2c1395b4 maps to this node"},"localConfig":{"_id":"e78f2c1395b4","version":1,"term":2,"members":[{"_id":0,"host":"e78f2c1395b4:27017","arbiterOnly":false,"buildIndexes":true,"hidden":false,"priority":1,"tags":{},"secondaryDelaySecs":0,"votes":1}],"protocolVersion":1,"writeConcernMajorityJournalDefault":true,"settings":{"chainingAllowed":true,"heartbeatIntervalMillis":2000,"heartbeatTimeoutSecs":10,"electionTimeoutMillis":10000,"catchUpTimeoutMillis":-1,"catchUpTakeoverDelayMillis":30000,"getLastErrorModes":{},"getLastErrorDefaults":{"w":1,"wtimeout":0},"replicaSetId":{"$oid":"67eda70babf0b748a47c3c94"}}}}
[W] REPL ReplCoord-0 Local replica set configuration document set name differs from command line set name; waiting for reconfig or remote heartbeat {"localConfigSetName":"e78f2c1395b4","commandLineSetName":"77ed7c7a97aa"}
Outputs of rs commands on the second run:
rs.status:
MongoServerError[InvalidReplicaSetConfig]: Our replica set config is invalid or we are not a member of it
rs.initiate:
MongoServerError[AlreadyInitialized]: already initialized
rs.config will have the original replica set id.