Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-2711

Tools fail with "a direct connection cannot be made if multiple hosts are specified" if mongodb+srv URI or a legacy uri containing multiple mongos is specified

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 100.2.0
    • Affects Version/s: 100.1.1
    • Component/s: None
    • None

      This is the failure when I'm trying to run mongodump against a sharded cluster:

      $ ./mongodump --version
      mongodump version: 100.1.1
      git version: 8bca136c2a0e0daa3947df31c0624c5615f9aa02
      Go version: go1.12.17
         os: linux
         arch: amd64
         compiler: gc
      
      $ ./mongodump --uri "mongodb+srv://xxx:xxx@cluster1.fu4ty.mongodb.net/?authSource=admin"
      2020-08-22T12:19:29.097+1000    Failed: can't create session: error configuring the connector: a direct connection cannot be made if multiple hosts are specified
      

      This appears to be a bug as the same command works fine with mongodump v4.2:

      $ /var/lib/mongodb-mms-automation/mongodb-linux-x86_64-4.2.3-ent/bin/mongodump --version
      mongodump version: r4.2.3
      git version: 6874650b362138df74be53d366bbefc321ea32d4
      Go version: go1.12.13
         os: linux
         arch: amd64
         compiler: gc
      $ /var/lib/mongodb-mms-automation/mongodb-linux-x86_64-4.2.3-ent/bin/mongodump --uri "mongodb+srv://xxx:xxx@cluster1.fu4ty.mongodb.net/?authSource=admin"
      2020-08-22T12:29:05.453+1000    writing admin.system.users to
      2020-08-22T12:29:05.921+1000    done dumping admin.system.users (5 documents)
      2020-08-22T12:29:06.155+1000    writing admin.system.roles to
      2020-08-22T12:29:06.622+1000    done dumping admin.system.roles (1 document)
      2020-08-22T12:29:06.855+1000    writing admin.system.version to
      2020-08-22T12:29:07.325+1000    done dumping admin.system.version (2 documents)
      2020-08-22T12:29:07.560+1000    writing config.changelog to
      2020-08-22T12:29:07.560+1000    writing config.chunks to
      

      Same error is thrown if a legacy mongodb:// URI is specified with multiple mongos listed.

      It appears that the workarounds are either:

      • Use an older version of the tools
      • Or use a mongodb:// URI with a single mongos specified

            Assignee:
            varsha.subrahmanyam@mongodb.com Varsha Subrahmanyam (Inactive)
            Reporter:
            dmitry.ryabtsev@mongodb.com Dmitry Ryabtsev
            Tim Fogarty
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: