[SERVER-36173] connection string with multiple mongos fails Created: 18/Jul/18  Updated: 19/Jul/18  Resolved: 18/Jul/18

Status: Closed
Project: Core Server
Component/s: Shell, Usability
Affects Version/s: 3.4.9
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Kay Agahd Assignee: Nick Brewer
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-28560 Support specifying multiple mongos pr... Closed
Participants:

 Description   

According to mongodb's documentation, the following connects to a sharded cluster with three mongos instances:

mongodb://router1.example.com:27017,router2.example2.com:27017,router3.example3.com:27017/

This seems not to work because we are receiving the following error:

2018-07-18T10:01:50.053+0200 E QUERY [thread1] Error: Cannot list multiple servers in URL without 'replicaSet' option :
connect@src/mongo/shell/mongo.js:237:13

We are running mongo version 3.4 (all mongos-es, mongod's and mongo shell are running v3.4).

We can connect to each mongos individually without problems:

10:10:15 > $ mongo mongo-shared-05.db00.pro06.eu.idealo.com:27017
MongoDB shell version v3.4.9
connecting to: mongo-shared-05.db00.pro06.eu.idealo.com:27017
MongoDB server version: 3.4.10
mongos> ^C
bye
10:10:35 > $ mongo mongo-shared-06.db00.pro05.eu.idealo.com:27017
MongoDB shell version v3.4.9
connecting to: mongo-shared-06.db00.pro05.eu.idealo.com:27017
MongoDB server version: 3.4.15
mongos> ^C
bye
10:11:15 > $ mongo mongo-shared-07.db00.pro06.eu.idealo.com:27017
MongoDB shell version v3.4.9
connecting to: mongo-shared-07.db00.pro06.eu.idealo.com:27017
MongoDB server version: 3.4.10
mongos> ^C
bye


However, once put together all three mongos-es in one connection string, we get the above mentioned error:

10:11:36 > $ mongo mongodb://mongo-shared-05.db00.pro06.eu.idealo.com:27017,mongo-shared-06.db00.pro05.eu.idealo.com:27017,mongo mongo-shared-07.db00.pro06.eu.idealo.com:27017/
FailedToParse: Cannot list multiple servers in URL without 'replicaSet' option
try 'mongo --help' for more information



 Comments   
Comment by Kay Agahd [ 19/Jul/18 ]

Thanks nick.brewer! I've updated the mongo shell to version 4.0.0 which is working well.
I suggest to update your mongodb documentation for the versions which fail.

the shell does not make any attempt to round-robin requests; they are directed to the first mongos listed.

Maybe I misunderstood you but if the first mongos listed in the connection string is wrong, mongo shell is still able to connect because it's taking the second one. If the first and second mongos entries are wrong, mongo shell uses the third mongos entry. That's good!

Comment by Nick Brewer [ 18/Jul/18 ]

kay.agahd@idealo.de,

I believe what you're seeing is a duplicate of SERVER-28560. As noted in that ticket, this issue is fixed in MongoDB 3.6 - I would recommend upgrading your shell version to 3.6.6. One thing I would point out from that ticket is that the shell does not make any attempt to round-robin requests; they are directed to the first mongos listed.

Regards,

Nick

 

Comment by Kay Agahd [ 18/Jul/18 ]

The last line contained a copy & paste typo (the result is the same). The correct one is:

10:12:04 > $ mongo mongodb://mongo-shared-05.db00.pro06.eu.idealo.com:27017,mongo-shared-06.db00.pro05.eu.idealo.com:27017,mongo-shared-07.db00.pro06.eu.idealo.com:27017/
FailedToParse: Cannot list multiple servers in URL without 'replicaSet' option
try 'mongo --help' for more information

Generated at Thu Feb 08 04:42:16 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.