2

I had to replace a mongodb config server in a cluster that contains only 1 shard.

By mistake, I started the new config server without any data and got the following message in the logs:

[CheckConfigServers] ERROR: could not verify that config servers are in sync :: caused by :: config servers configserver1.mydomain.com:27019 and configserver2.mydomain.com:27019 differ

Following the procedure at 'http://docs.mongodb.org/manual/tutorial/replace-config-server/', I tried to stop the balancer from a mongos. But I got an error message. I could only stop the balancer after having restarted the empty configserver.

I copied the dbpath content from configserver2 to configserver1 and everything looks fine.

I'd like to ensure that no data has been misplaced or lost during these operations. With only 1 shard in the cluster, could data be misplaced?

Thanks,

Greg.

Icu
  • 1,405
  • 2
  • 15
  • 25

2 Answers2

3

The CheckConfigServers warning message you received on startup is a sanity check to prevent any metadata changes (eg. chunk migration as a result of a balancing round) from happening while the config servers are in an inconsistent state.

Stopping the config server with the empty dbpath and recopying the data from a known good config server was the correct action to take. The MongoDB config servers are not a replica set, and are kept in sync via two-phase commits coordinated by the mongod/mongos servers in your sharded cluster.

If you only have one shard than data will not be misplaced; there is nowhere for it to have migrated to.

Additionally, if you have enabled sharding but haven't sharded any collections the data will all live on the primary shard.

Stennie
  • 1,250
  • 7
  • 12
  • Thanks a lot. I'd like to clarify one more detail. Following the procedure above, if I have to replace a config server, I must disable the balancer and stop one of the 2 remaining config servers to copy valid metadatas. But with only 2 config servers still online, I can't disable the balancer. I get the following message: "SyncClusterConnection::udpate prepare failed" – Icu Aug 22 '13 at 07:15
  • The balancer will not run without all config servers available, so the sharded cluster metadata is implicitly read-only if one or more servers are unavailable. The error message is expected: you can stop of your remaining config servers, do the file copy, and then start up the config servers to resume normal operation. If you were doing planned maintenance you could stop the balancer before taking down a config server, which would try to complete any migration in progress before stopping the balancer. – Stennie Aug 22 '13 at 10:02
1

I would think that you should be alright with running the printShardingStatus() command .

gWaldo
  • 11,887
  • 8
  • 41
  • 68
  • All my dbs have 'partitioned = false'. If sharding is disabled, I guess that no data could have been misplaced – Icu Aug 21 '13 at 12:32