Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-455

Can't connect to the replica server where replica set is not initiated yet

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.7.7
    • Component/s: Shell
    • Labels:
      None
    • Documentation Changes:
      Not Needed

      Description

      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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              sergey.petushkov Sergey Petushkov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: