-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Embedded Shell
-
None
-
Not Needed
Problem Description
mongosh times out trying to connect to the mongodb server that is configured to be a replica set but where the replica is not initiated yet.
Steps to Reproduce
Create a mongodb server config similar to this:
storage: dbPath: ~/mongodb/replset/data net: bindIp: localhost port: 27041 security: authorization: enabled keyFile: ~/mongodb/replset/keyfile systemLog: destination: file path: ~/mongodb/replset/mongod.log logAppend: true processManagement: fork: true replication: replSetName: replset
Start the server with the mongod:
mongod -f ./config.yml
Connect to the server with mongosh:
mongosh mongodb://localhost:27041/test
Expected Results
mongosh connects to the server without any issues
Actual Results
mongosh can't connect due to the timeout error:
> mongosh mongodb://localhost:27041/test < Current sessionID: 5fb7a1512ccac09e1bc8259a < Connecting to: mongodb://localhost:27041/test < MongoServerSelectionError: Server selection timed out after 30000 ms
Additional Notes
- mongo shell can connect to the server created the same way with no issues
- After replica set is initiated (for example through mongo shell with rs.initiate()), mongosh can connect to the server without any issues
- mongod version 4.4.1
- mongo version 4.4.1
- mongosh version 0.5.2
- depends on
-
NODE-2901 v3.6.3/v4.0.0 fails to connect to uninitialized replset with useUnifiedTopology
- Closed