在MongoDB分片群集上运行sh.status()命令时获取异常

时间:2018-11-15 06:26:02

标签: mongodb sharding

我在碎片化的Mongo集群的mongos实例上运行sh.status()命令,并且出现异常。

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

我正在ubuntu 16.04平台上运行Mongo 3.2。在ubuntu 14.04平台上的MongoDB 3.0版上运行正常。我已经重新安装了所有内容,并且也在新计算机上尝试了此操作,除了sh.status()命令之外,其他所有功能都正常运行。

谢谢。

1 个答案:

答案 0 :(得分:0)

这是因为我的mongo配置服务器中启用了notablescan属性。禁用notablescan后,命令运行正常。您可以通过运行此命令来检查notablescan的状态。

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

如果启用notablescan,则输出如下所示。

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