-
Type: Improvement
-
Resolution: Done
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: Sharding
-
None
The _id field in config.mongos pings collection comes from the balancer id and is based on the gethostname() call result:
bool Balancer::_init() { try { log() << "about to contact config servers and shards" << endl; // contact the config server and refresh shard information // checks that each shard is indeed a different process (no hostname mixup) // these checks are redundant in that they're redone at every new round but we want to do them initially here // so to catch any problem soon Shard::reloadShardInfo(); _checkOIDs(); log() << "config servers and shards contacted successfully" << endl; StringBuilder buf; buf << getHostNameCached() << ":" << serverGlobalParams.port; _myid = buf.str(); _started = time(0); log() << "balancer id: " << _myid << " started at " << time_t_to_String_short(_started) << endl; return true; }
The ping _id fields are used by MMS (and probably some other monitoring software) for mongoS auto-discovery. However, in some use cases hostnames might not actually be resolvable, or they might not make any sense at all (e.g. if Dockers containers are used for automation).
I think it will be useful if mongoS would have a parameter to override the ping _id value through the config file.