Search code examples
mongodbsharding

Getting exception on running sh.status() command on MongoDB sharded cluster


I am running sh.status() command on my mongos instance of sharded Mongo cluster and I am getting below exception.

mongos> sh.status()
assert: command failed: {
    "ok" : 0,
    "errmsg" : "error processing query: ns=config.mongosTree: ping $gt new Date(1542173873192)\nSort: {}\nProj: {}\n No query solutions",
    "code" : 2
} : aggregate failed
_getErrorWithCode@src/mongo/shell/utils.js:25:13
doassert@src/mongo/shell/assert.js:16:14
assert.commandWorked@src/mongo/shell/assert.js:290:5
DBCollection.prototype.aggregate@src/mongo/shell/collection.js:1312:5
printShardingStatus@src/mongo/shell/utils_sh.js:611:13
sh.status@src/mongo/shell/utils_sh.js:78:5
@(shell):1:1

2018-11-14T05:38:55.904+0000 E QUERY    [thread1] Error: command failed: {
    "ok" : 0,
    "errmsg" : "error processing query: ns=config.mongosTree: ping $gt new Date(1542173873192)\nSort: {}\nProj: {}\n No query solutions",
    "code" : 2
} : aggregate failed :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
doassert@src/mongo/shell/assert.js:16:14
assert.commandWorked@src/mongo/shell/assert.js:290:5
DBCollection.prototype.aggregate@src/mongo/shell/collection.js:1312:5
printShardingStatus@src/mongo/shell/utils_sh.js:611:13
sh.status@src/mongo/shell/utils_sh.js:78:5
@(shell):1:1

I am running Mongo 3.2 on ubuntu 16.04 platform. It is working fine on MongoDB version 3.0 on ubuntu 14.04 platform. I have reinstalled everything and tried this on new machines too, everything is working fine except sh.status() command.

Thanks.


Solution

  • It was becuase notablescan property enabled in my mongo config servers. After disable notablescan, command is working fine. you can check status of notablescan by running this command.

    db.adminCommand( { getParameter: 1, notablescan: 1 } )
    

    Output would be like below if notablescan is enabled.

    {
      "notablescan": true,
      "ok": 1
    }