Details
-
Bug
-
Status: Done
-
Medium
-
Resolution: Fixed
-
3.1.0
-
None
-
None
-
None
-
Yes
-
Yes
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.