M103: Lab - Configure a Sharded Cluster: Cannot restart mongod after updating configuration

Hey,

I am stuck on the lab about configuring a sharded cluster. I got to the point where we have a config server replication set. I then update the configuration with the needed lines given in the lab replacing the configsvr key.

When I attempt to launch the mongod with this new config it will fail silently without forking and I never see the process when I run “ps -ef | grep mongod” if I leave forking enabled.

The logs show me this:
“[initandlisten] No oplog entries to apply for recovery. appliedThrough and checkpointTimestamp are both null.
1845 2019-12-02T03:20:19.531+0000 E REPL [replexec-0] Locally stored replica set configuration is invalid; See http://www.mongodb.org/dochub/core/recover-replica-set-from-invalid-config for information on how to recover from this. Got “BadValue: Nodes being used for config servers must be started with the --configsvr flag” while validating { _id: “m103-csrs”, version: 3, configsvr: true, protocolVersion: 1, members: [ { _id: 0, host: “192.168.103.100:26001”, arbiterOnly: false, buildIndexes: true, hidden: false, priority: 1.0, tags: {}, slaveDelay: 0, votes: 1 }, { _id: 1, host: “192.168.103.100:26002”, arbiterOnly: false, buildIndexes: true, hidden: false, priority: 1.0, tags: {}, slaveDelay: 0, votes: 1 }, { _id: 2, host: “192.168.103.100:26003”, arbiterOnly: false, buildIndexes: true, hidden: false, priority: 1.0, tags: {}, slaveDelay: 0, votes: 1 } ], settings: { chainingAllowed: true, heartbeatIntervalMillis: 2000, heartbeatTimeoutSecs: 10, electionTimeoutMillis: 10000, catchUpTimeoutMillis: -1, catchUpTakeoverDelayMillis: 30000, getLastErrorModes: {}, getLastErrorDefaults: { w: 1, wtimeout: 0 }, replicaSetId: ObjectId(‘5de4720100b634ccf6e40bf9’) } }”

Which I beleive is causing the process to die.

There’s a potential misconfiguration.
The configuration files for the config servers should be brand new and built from scratch. There should be no substitution or replacement of config options such as configsvr. All you needed to do was copy the config settings given in the lab for the primary config server node, then use that as a template for the other two secondary nodes.

Can you elaborate on exactly what you did? What was your thought process?

Hi @Caleb_97445,

The error message says Locally stored replica set configuration is invalid.

You cannot repurpose an existing replica set into config servers because of the additional restrictions on the replica set config servers.

For the resolution of the issue, I would recommend you to delete the db directory. For additional information, please refer this post.

Hope it helps!

If you still have any query then please feel free to get back to us.

Happy Learning :slight_smile:

Thanks,
Shubham Ranjan
Curriculum Support Engineer