mongodb平衡器不会停止

时间:2016-02-24 03:58:19

标签: mongodb migration

重新启动分片群集后,我发现平衡器不再迁移任何数据,但命令sh.isBalancerRunning()始终返回true。

我试图运行命令sh.stopBalancer()并且它永远停留在:

sh.stopBalancer()
Waiting for active hosts...
Waiting for the balancer lock...

在这里检查配置服务器锁是数据:

configsvr> db.locks.find({_id: "balancer"})
{ "_id" : "balancer", "process" : "myserver.mongodb.com:27017:1452776409:1804289383", 
"state" : 2, "ts" : ObjectId("56cb817f2c4edd1226d6ae07"), "when" : ISODate("2016-02-22T21:45:35.360Z"), "who" : "myserver.mongodb.com:27017:1452776409:1804289383:Balancer:846930886", 
"why" : "doing balance round" }

此外,如果我尝试运行sh.startBalancer(),则超时:

mongos> sh.startBalancer()
2016-02-23T22:51:11.204-0500 E QUERY    [thread1] Error: assert.soon failed, msg:Waited too long for lock balancer to change to state undefined :
doassert@src/mongo/shell/assert.js:15:14
assert.soon@src/mongo/shell/assert.js:200:13
sh.waitForDLock@src/mongo/shell/utils_sh.js:171:1
sh.waitForBalancer@src/mongo/shell/utils_sh.js:264:9
sh.startBalancer@src/mongo/shell/utils_sh.js:146:5
@(shell):1:1
sh.status()中的

balancer:
  Currently enabled:  yes
  Currently running:  yes
    Balancer lock taken at Mon Feb 22 2016 16:45:35 GMT-0500 (EST) by myserver.mongodb.com:27017:1452776409:1804289383:Balancer:846930886
    Balancer active window is set between 8:00 and 6:00 server local time
Failed balancer rounds in last 5 attempts:  5
Last reported error:  Connection refused
Time of Reported error:  Tue Feb 23 2016 17:27:26 GMT-0500 (EST)
Migration Results for the last 24 hours:
    No recent migrations

我尝试重新启动服务器,逐步降低原色,将锁定平衡器状态更改为0并运行sh.startBalancer()并从锁定数据库中删除平衡器字段并尝试运行{{ 1}}再次没有结果。

1 个答案:

答案 0 :(得分:1)

最后这是一个服务器时钟不同步的问题,由于某些原因,关于这个问题的日志直到第二天才出现。

希望这可以帮助有类似问题的人:)