-
Type: Bug
-
Resolution: Incomplete
-
Priority: Minor - P4
-
None
-
Affects Version/s: 3.2.7
-
Component/s: mongostat
-
Environment:Centos 6.6 (kernel 2.6.32, x86_64)
-
Platforms 2016-08-26
The mongostat documentation says "The mongostat utility provides a quick overview of the status of a currently running mongod or mongos instance" and, for --discover, "When connected to a mongos, mongostat will return data from all shards in the cluster."
Instead, when run against a mongos, mongostat just gives the error message "Failed: error connecting to db server: no reachable servers"
$ mongostat
2016-06-16T11:11:15.345-0400 Failed: error connecting to db server: no reachable servers
$ mongostat --discover
2016-06-16T11:11:22.690-0400 Failed: error connecting to db server: no reachable servers
$ mongostat --discover -vvvvv
2016-06-16T11:11:26.593-0400 adding new host to monitoring: localhost:27017
2016-06-16T11:11:26.593-0400 polling server: localhost:27017
2016-06-16T11:11:26.594-0400 getting session on server: localhost:27017
2016-06-16T11:11:30.097-0400 got error getting session to server localhost:27017
2016-06-16T11:11:30.097-0400 successfully got statline from host: localhost:27017
2016-06-16T11:11:30.097-0400 Failed: error connecting to db server: no reachable servers
But when just using mongo, we can connect to the local mongos just fine and view the hosts in the shards:
$ mongo --host localhost --port 27017
MongoDB shell version: 3.2.7
connecting to: localhost:27017/test
mongos> sh.status()
— Sharding Status —
sharding version:
shards:
{ "_id" : "damshard1", "host" : damshard1/host1:27017,host2:27017" } { "_id" : "damshard2", "host" : damshard2/host3:27017,host4:27017" } { "_id" : "damshard3", "host" : damshard3/host5:27017,host6:27017" } active mongoses:
"3.2.7" : 3
balancer:
Currently enabled: yes
Currently running: no
Balancer active window is set between 01:00 and 03:00 server local time
Failed balancer rounds in last 5 attempts: 0
Migration Results for the last 24 hours:
52 : Success
databases:
dam.fs.chunks
shard key:
unique: false
balancing: true
chunks:
damshard1 2640
damshard2 2669
damshard3 2640
too many chunks to print, use verbose if you want to force print
and mongostat can connect, from the same host where mongos is running, to a replica set:
$ mongostat --host=damshard1/host1:27017,host2:27017
insert query update delete getmore command flushes mapped vsize res faults qr|qw ar|aw netIn netOut conn set repl time
host1:27017 *0 *0 *0 *0 0 2|0 0 197.9G 396.8G 46.5G 0 0|0 0|0 246b 13k 12 damshard1 SEC 2016-06-16T11:18:57-04:00
host2:27017 *0 6 *0 *0 1 4|0 0 197.9G 397.2G 11.3G 0 0|0 0|0 2k 20k 67 damshard1 PRI 2016-06-16T11:18:57-04:00