[SERVER-21320] Mongos defaults to wrong port for config servers Created: 05/Nov/15  Updated: 25/Jan/17  Resolved: 18/Nov/15

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 3.2.0-rc2
Fix Version/s: 3.2.0-rc4

Type: Bug Priority: Minor - P4
Reporter: Osmar Olivo Assignee: Andy Schwerin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Sharding C (11/20/15)
Participants:

 Description   

When starting up a mongos in the 3.2RC's, if you provide a seedlist for the config servers without specifying the port #'s for each, it defaults to 27017. This default makes little sense given that config servers by default start on port 27019.

If trying to use standard config server defaults this gets confusing since the defaults don't work with each other.



 Comments   
Comment by Andy Schwerin [ 18/Nov/15 ]

3.0 behavior restored.

Comment by Githook User [ 18/Nov/15 ]

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@mongodb.com'}

Message: SERVER-21320 When no port is provided for a configdb argument to mongos, assume
port 27019.

This is the behavior for mongodb 3.0 and prior, which was inadvertently removed
while refactoring sharding code in preparation for SERVER-1448.
Branch: master
https://github.com/mongodb/mongo/commit/5d22dc0c4ea4e611464c75b356f52741184359e6

Comment by Andy Schwerin [ 10/Nov/15 ]

My mistake. I misread the old behavior in code inspection.

Comment by Ramon Fernandez Marina [ 10/Nov/15 ]

This behavior (defaulting to 27017) is different from previous releases:

  • 2.4.14:

    $ mongos --configdb 127.0.0.1
    Tue Nov 10 07:18:26.033 warning: running with 1 config server should be done only for testing purposes and is not recommended for production
    Tue Nov 10 07:18:26.035 [mongosMain] MongoS version 2.4.14 starting: pid=30948 port=27017 64-bit host=tab (--help for usage)
    Tue Nov 10 07:18:26.035 [mongosMain] git version: 05bebf9ab15511a71bfbded684bb226014c0a553
    Tue Nov 10 07:18:26.035 [mongosMain] build info: Linux ip-10-154-253-119 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_49
    Tue Nov 10 07:18:26.035 [mongosMain] options: { configdb: "127.0.0.1" }
    Tue Nov 10 07:18:26.035 [mongosMain] warning:  couldn't check dbhash on config server 127.0.0.1:27019 :: caused by :: 11002 socket exception [CONNECT_ERROR] server [127.0.0.1:27019] mongos connectionpool error: couldn't connect to server 127.0.0.1:27019
    Tue Nov 10 07:18:26.035 [mongosMain] ERROR: error upgrading config database to v4 :: caused by :: could not load config version for upgrade :: caused by :: 11002 socket exception [CONNECT_ERROR] server [127.0.0.1:27019] mongos connectionpool error: couldn't connect to server 127.0.0.1:27019
    

  • 2.6.11:

    $ mongos --configdb 127.0.0.1
    2015-11-10T07:18:06.766-0500 warning: running with 1 config server should be done only for testing purposes and is not recommended for production
    2015-11-10T07:18:06.767-0500 [mongosMain] MongoS version 2.6.11 starting: pid=30930 port=27017 64-bit host=tab (--help for usage)
    2015-11-10T07:18:06.767-0500 [mongosMain] db version v2.6.11
    2015-11-10T07:18:06.767-0500 [mongosMain] git version: d00c1735675c457f75a12d530bee85421f0c5548
    2015-11-10T07:18:06.767-0500 [mongosMain] build info: Linux build4.ny.cbi.10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
    2015-11-10T07:18:06.767-0500 [mongosMain] allocator: tcmalloc
    2015-11-10T07:18:06.767-0500 [mongosMain] options: { sharding: { configDB: "127.0.0.1" } }
    2015-11-10T07:18:06.768-0500 [mongosMain] warning: Failed to connect to 127.0.0.1:27019, reason: errno:111 Connection refused
    2015-11-10T07:18:06.768-0500 [mongosMain] warning:  couldn't check dbhash on config server 127.0.0.1:27019 :: caused by :: 11002 socket exception [CONNECT_ERROR] server [127.0.0.1:27019] connection pool error: couldn't connect to server 127.0.0.1:27019 (127.0.0.1), connection attempt failed
    2015-11-10T07:18:06.768-0500 [mongosMain] warning: Failed to connect to 127.0.0.1:27019, reason: errno:111 Connection refused
    2015-11-10T07:18:06.768-0500 warning: Failed to connect to 127.0.0.1:27019, reason: errno:111 Connection refused
    2015-11-10T07:18:06.768-0500 warning:  couldn't check dbhash on config server 127.0.0.1:27019 :: caused by :: 11002 socket exception [CONNECT_ERROR] server [127.0.0.1:27019] connection pool error: couldn't connect to server 127.0.0.1:27019 (127.0.0.1), connection attempt failed
    2015-11-10T07:18:06.768-0500 [mongosMain] ERROR: error upgrading config database to v5 :: caused by :: could not load config version for upgrade :: caused by :: connection pool: connect failed 127.0.0.1:27019 : couldn't connect to server 127.0.0.1:27019 (127.0.0.1), connection attempt failed
    

  • 3.0.7:

    $ mongos --configdb 127.0.0.1
    2015-11-10T07:17:14.593-0500 W SHARDING running with 1 config server should be done only for testing purposes and is not recommended for production
    2015-11-10T07:17:14.595-0500 I SHARDING [mongosMain] MongoS version 3.0.7 starting: pid=30863 port=27017 64-bit host=tab (--help for usage)
    2015-11-10T07:17:14.595-0500 I CONTROL  [mongosMain] db version v3.0.7
    2015-11-10T07:17:14.595-0500 I CONTROL  [mongosMain] git version: 6ce7cbe8c6b899552dadd907604559806aa2e9bd
    2015-11-10T07:17:14.595-0500 I CONTROL  [mongosMain] build info: Linux build16.ny.cbi.10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
    2015-11-10T07:17:14.595-0500 I CONTROL  [mongosMain] allocator: tcmalloc
    2015-11-10T07:17:14.595-0500 I CONTROL  [mongosMain] options: { sharding: { configDB: "127.0.0.1" } }
    2015-11-10T07:17:14.595-0500 W NETWORK  [mongosMain] Failed to connect to 127.0.0.1:27019, reason: errno:111 Connection refused
    2015-11-10T07:17:14.595-0500 W SHARDING [mongosMain]  couldn't check dbhash on config server 127.0.0.1:27019 :: caused by :: 11002 socket exception [CONNECT_ERROR] server [127.0.0.1:27019] connection pool error: couldn't connect to server 127.0.0.1:27019 (127.0.0.1), connection attempt failed
    2015-11-10T07:17:14.595-0500 W NETWORK  [mongosMain] Failed to connect to 127.0.0.1:27019, reason: errno:111 Connection refused
    2015-11-10T07:17:14.595-0500 W NETWORK  Failed to connect to 127.0.0.1:27019, reason: errno:111 Connection refused
    2015-11-10T07:17:14.595-0500 E -        [mongosMain] error upgrading config database to v6 :: caused by :: could not load config version for upgrade :: caused by :: connection pool: connect failed 127.0.0.1:27019 : couldn't connect to server 127.0.0.1:27019 (127.0.0.1), connection attempt failed
    

  • 3.2.0-rc2:

    $ mongos --configdb 127.0.0.1
    2015-11-10T07:17:45.679-0500 W SHARDING [main] Running a sharded cluster with fewer than 3 config servers should only be done for testing purposes and is not recommended for production.
    2015-11-10T07:17:45.682-0500 I SHARDING [mongosMain] MongoS version 3.2.0-rc2 starting: pid=30882 port=27017 64-bit host=tab (--help for usage)
    2015-11-10T07:17:45.682-0500 I CONTROL  [mongosMain] db version v3.2.0-rc2
    2015-11-10T07:17:45.682-0500 I CONTROL  [mongosMain] git version: 8a3acb42742182c5e314636041c2df368232bbc5
    2015-11-10T07:17:45.682-0500 I CONTROL  [mongosMain] allocator: tcmalloc
    2015-11-10T07:17:45.682-0500 I CONTROL  [mongosMain] modules: none
    2015-11-10T07:17:45.682-0500 I CONTROL  [mongosMain] build environment:
    2015-11-10T07:17:45.682-0500 I CONTROL  [mongosMain]     distarch: x86_64
    2015-11-10T07:17:45.682-0500 I CONTROL  [mongosMain]     target_arch: x86_64
    2015-11-10T07:17:45.682-0500 I CONTROL  [mongosMain] options: { sharding: { configDB: "127.0.0.1" } }
    2015-11-10T07:17:45.682-0500 I SHARDING [mongosMain] Updating config server connection string to: 127.0.0.1:27017
    2015-11-10T07:17:45.683-0500 W NETWORK  [mongosMain] Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
    2015-11-10T07:17:45.683-0500 W SHARDING [mongosMain]  couldn't check dbhash on config server 127.0.0.1:27017 :: caused by :: 13328 connection pool: connect failed 127.0.0.1:27017 : couldn't connect to server 127.0.0.1:27017, connection attempt failed
    2015-11-10T07:17:45.683-0500 W NETWORK  [mongosMain] Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
    2015-11-10T07:17:45.683-0500 W NETWORK  [thread1] Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
    2015-11-10T07:17:45.683-0500 W SHARDING [thread1]  couldn't check dbhash on config server 127.0.0.1:27017 :: caused by :: 13328 connection pool: connect failed 127.0.0.1:27017 : couldn't connect to server 127.0.0.1:27017, connection attempt failed
    2015-11-10T07:17:45.683-0500 E SHARDING [mongosMain] uncaught DBException in mongos main: 13328 connection pool: connect failed 127.0.0.1:27017 : couldn't connect to server 127.0.0.1:27017, connection attempt failed
    

However when I start up a config server it defaults to 27019 as documented:

  • CSRS (as per release notes, but omitting the port):

    $ mongod --configsvr --replSet cfg1 --dbpath cfg
    2015-11-10T07:22:15.950-0500 I CONTROL  [initandlisten] MongoDB starting : pid=31110 port=27019 dbpath=cfg 64-bit host=tab
    2015-11-10T07:22:15.950-0500 I CONTROL  [initandlisten] db version v3.2.0-rc2
    2015-11-10T07:22:15.950-0500 I CONTROL  [initandlisten] git version: 8a3acb42742182c5e314636041c2df368232bbc5
    2015-11-10T07:22:15.950-0500 I CONTROL  [initandlisten] allocator: tcmalloc
    2015-11-10T07:22:15.950-0500 I CONTROL  [initandlisten] modules: none
    2015-11-10T07:22:15.950-0500 I CONTROL  [initandlisten] build environment:
    2015-11-10T07:22:15.950-0500 I CONTROL  [initandlisten]     distarch: x86_64
    2015-11-10T07:22:15.950-0500 I CONTROL  [initandlisten]     target_arch: x86_64
    2015-11-10T07:22:15.950-0500 I CONTROL  [initandlisten] options: { replication: { replSet: "cfg1" }, sharding: { clusterRole: "configsvr" }, storage: { dbPath: "cfg" } }
    2015-11-10T07:22:15.964-0500 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=37G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
    2015-11-10T07:22:16.100-0500 I REPL     [initandlisten] Did not find local voted for document at startup;  NoMatchingDocument Did not find replica set lastVote document in local.replset.election
    2015-11-10T07:22:16.100-0500 I REPL     [initandlisten] Did not find local replica set configuration document at startup;  NoMatchingDocument Did not find replica set configuration document in local.system.replset
    2015-11-10T07:22:16.100-0500 I NETWORK  [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
    2015-11-10T07:22:16.100-0500 I FTDC     [initandlisten] Starting full-time diagnostic data capture with directory 'cfg/diagnostic.data'
    2015-11-10T07:22:16.124-0500 I NETWORK  [initandlisten] waiting for connections on port 27019
    

  • SCCC:

    $ mongod --configsvr --configsvrMode sccc  --dbpath cfg
    2015-11-10T07:26:35.668-0500 I CONTROL  [initandlisten] MongoDB starting : pid=31287 port=27019 dbpath=cfg master=1 64-bit host=tab
    2015-11-10T07:26:35.668-0500 I CONTROL  [initandlisten] db version v3.2.0-rc2
    2015-11-10T07:26:35.668-0500 I CONTROL  [initandlisten] git version: 8a3acb42742182c5e314636041c2df368232bbc5
    2015-11-10T07:26:35.668-0500 I CONTROL  [initandlisten] allocator: tcmalloc
    2015-11-10T07:26:35.668-0500 I CONTROL  [initandlisten] modules: none
    2015-11-10T07:26:35.668-0500 I CONTROL  [initandlisten] build environment:
    2015-11-10T07:26:35.668-0500 I CONTROL  [initandlisten]     distarch: x86_64
    2015-11-10T07:26:35.668-0500 I CONTROL  [initandlisten]     target_arch: x86_64
    2015-11-10T07:26:35.668-0500 I CONTROL  [initandlisten] options: { sharding: { clusterRole: "configsvr", configsvrMode: "sccc" }, storage: { dbPath: "cfg" } }
    2015-11-10T07:26:35.682-0500 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=37G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
    2015-11-10T07:26:35.802-0500 I REPL     [initandlisten] ******
    2015-11-10T07:26:35.802-0500 I REPL     [initandlisten] creating replication oplog of size: 5MB...
    2015-11-10T07:26:35.811-0500 I STORAGE  [initandlisten] Starting WiredTigerRecordStoreThread local.oplog.$main
    2015-11-10T07:26:35.811-0500 I STORAGE  [initandlisten] Scanning the oplog to determine where to place markers for when to truncate
    2015-11-10T07:26:35.903-0500 I REPL     [initandlisten] ******
    2015-11-10T07:26:35.903-0500 I NETWORK  [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
    2015-11-10T07:26:35.903-0500 I FTDC     [initandlisten] Starting full-time diagnostic data capture with directory 'cfg/diagnostic.data'
    2015-11-10T07:26:35.945-0500 I NETWORK  [initandlisten] waiting for connections on port 27019
    

If there's no pilot error above then I'd say this is very confusing: why would we default to listen to one port and connect to another? And if we decide to do this, is there any documentation that may need updating?

Comment by Andy Schwerin [ 10/Nov/15 ]

This is as designed, and consistent with both SCCC and normal replica set behavior.

Comment by Kelsey Schubert [ 09/Nov/15 ]

I have reproduced on 3.2.0-rc2. Sending it to triage.

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