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

Mongostat doesn't accept connection string with replset name and seed list

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • Legacy C++ Implementation
    • mongostat

    Description

      Problem

      The docs on mongostat say:

      --host <hostname><:port>
      ...
      To connect to a replica set, you can specify the replica set seed name, and a seed list of set members, in the following format:

      <replica_set_name>/<hostname1><:port>,<hostname2:<port>,...

      This does not work. Mongostat does not accept a replica set name + seed list in the usual connection string format.

      Example

      $ mongostat --host replset/capslock.local:27017,capslock.local:27018,capslock.local:27019
       
                                  	insert  query update delete getmore command flushes mapped  vsize    res faults  locked db idx miss %     qr|qw   ar|aw  netIn netOut  conn     set repl       time 
              capslock.local:27018	    *0     *0     *0     *0       0     3|0       0   336m  3.15g     3m      0 local:0.0%          0       0|0     0|0   328b     3k     3 replset  SEC   09:54:24 
              capslock.local:27019	    *0     *0     *0     *0       0     3|0       0   336m  3.15g     3m      0 local:0.0%          0       0|0     0|0   328b     3k     3 replset  SEC   09:54:24 
      replset/capslock.local:27017	socket exception [CONNECT_ERROR] for replset/capslock.local:27017

      Reason

      The runMany() function (see src/tools/stat.cpp:430) splits the host parameter just by "," with StringSplitter.

      Expected behavior

      When specifying a connection string with replica set name and seed list, it should properly connect to one of the seed nodes and discover the rest of the replica set (similar to --discover). If we don't want to duplicate this functionality, we should at least ignore the replica set name (i.e. strip it off the string before), then show the provided hosts in the seed list. But then we need to also change the docs to point to --discover instead for full replica set display.

      Attachments

        Activity

          People

            Unassigned Unassigned
            ian@mongodb.com Ian Whalen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: