Uploaded image for project: 'Percona Toolkit'
  1. Percona Toolkit
  2. PT-1822

pt-mongodb-summary fails on standalone mongodb instances

Details

    • Bug
    • Status: Done
    • Medium
    • Resolution: Fixed
    • 3.1.0
    • None
    • None
    • None

    Description

      The tool will fail if we run it against a standalone instance, user test has "root" role here.

      [email protected]:~# pt-mongodb-summary mongo:27017 -- -u test -p t3st -a admin
      ERRO[0000] Cannot get hostnames: cannot getShardMap for GetHostnames: (Unauthorized) command getShardMap requires authentication 
      ERRO[0000] Cannot get host info for "mongodb://mongo:27017": GetHostInfo.hostInfo: (Unauthorized) command hostInfo requires authentication
      

      I don't see any indication that pt-mongodb-summary is not suited to collect information from single standalone instances. Otherwise this is going to be a DOC issue.

      If the tool is expected to work on standalone mongodb instances, we should account for error 203 when the getShardMap command is executed in https://github.com/percona/percona-toolkit/blob/3.0/src/go/mongolib/util/util.go#L120

      > db.runCommand("getShardMap")
      {
              "ok" : 0,
              "errmsg" : "Sharding is not enabled",
              "code" : 203,
              "codeName" : "ShardingStateNotInitialized"
      }
      

      And assume that this host is a standalone instance instead of failing.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jericho.rivera Jericho Rivera (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - Not Specified
                  Not Specified
                  Logged:
                  Time Spent - 4 hours, 40 minutes
                  4h 40m

                  Smart Checklist