[SERVER-15775] Make mongos ping _id configurable Created: 21/Oct/14  Updated: 12/Nov/14  Resolved: 07/Nov/14

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Alexander Komyagin Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Participants:

 Description   

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.



 Comments   
Comment by Alexander Komyagin [ 07/Nov/14 ]

Closing as per my discussion with John. We agreed that the real user need here is to hide Docker hosts from MMS, which is best addressed by changes in MMS.

Comment by Alexander Komyagin [ 29/Oct/14 ]

My idea here is to allow MMS (or any other monitoring system) to get mongoS hostnames from pings in config.pings. So it should be a single field initialized with gethostname() by default.

Comment by Greg Studer [ 29/Oct/14 ]

I was considering the other way - a "name" field - this way there would be no confusion about whether the hostname was "real" or now.

Comment by Alexander Komyagin [ 27/Oct/14 ]

I can see that we could introduce a new field in the ping doc, e.g. "hostname". We could fill it with gethostname() by default, but allow users to override the value with some manual setting. Will it be better?

Comment by Greg Studer [ 27/Oct/14 ]

I could see a case for additional naming information to be included in the ping, but think this would be a more useful addition-to rather than a replacement-for the ping _id.

Generated at Thu Feb 08 03:38:57 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.