我发现MongoDB辅助节点正在恢复时optimeDate并未更改。
这是否意味着RECOVERING没有任何进展?
这是rs.status()的输出,node03的optimeDate是ISODate(“ 2018-07-18T13:29:54Z”),并且从未更改。
rs.status()
{
"set" : "rs0",
"date" : ISODate("2018-07-18T17:19:09.282Z"),
"myState" : 1,
"term" : NumberLong(112),
"heartbeatIntervalMillis" : NumberLong(2000),
"members" : [
{
"_id" : 3,
"name" : "node04:27017",
"health" : 1,
"state" : 1,
"stateStr" : "PRIMARY",
"uptime" : 4492076,
"optime" : {
"ts" : Timestamp(1531934019, 1),
"t" : NumberLong(112)
},
"optimeDate" : ISODate("2018-07-18T17:13:39Z"),
"electionTime" : Timestamp(1531927161, 1),
"electionDate" : ISODate("2018-07-18T15:19:21Z"),
"configVersion" : 50813,
"self" : true
},
{
"_id" : 4,
"name" : "node02:27017",
"health" : 1,
"state" : 7,
"stateStr" : "ARBITER",
"uptime" : 7181,
"lastHeartbeat" : ISODate("2018-07-18T17:19:09.060Z"),
"lastHeartbeatRecv" : ISODate("2018-07-18T17:19:08.707Z"),
"pingMs" : NumberLong(0),
"configVersion" : 50813
},
{
"_id" : 5,
"name" : "node03:27017",
"health" : 1,
"state" : 3,
"stateStr" : "RECOVERING",
"uptime" : 7192,
"optime" : {
"ts" : Timestamp(1531920594, 57),
"t" : NumberLong(107)
},
"optimeDate" : ISODate("2018-07-18T13:29:54Z"),
"lastHeartbeat" : ISODate("2018-07-18T17:19:08.769Z"),
"lastHeartbeatRecv" : ISODate("2018-07-18T17:19:09.090Z"),
"pingMs" : NumberLong(0),
"configVersion" : 50813
}
],
"ok" : 1
}
答案 0 :(得分:0)
我检查了mongodb容器的日志。实际上,如果失败,则进行恢复:
docker logs --tail 1000 composedeployment_mongo_1 | grep REPL
2018-07-18T21:31:18.517+0000 I REPL [ReplicationExecutor] syncing from: node04:27017
2018-07-18T21:31:18.519+0000 W REPL [rsBackgroundSync] we are too stale to use node04:27017 as a sync source
2018-07-18T21:31:18.519+0000 I REPL [ReplicationExecutor] could not find member to sync from
2018-07-18T21:31:18.519+0000 E REPL [rsBackgroundSync] too stale to catch up -- entering maintenance mode
2018-07-18T21:31:18.519+0000 I REPL [rsBackgroundSync] our last optime : (term: 107, timestamp: Jul 18 13:29:54:38)
2018-07-18T21:31:18.519+0000 I REPL [rsBackgroundSync] oldest available is (term: 112, timestamp: Jul 18 16:36:08:87)
2018-07-18T21:31:18.519+0000 I REPL [rsBackgroundSync] See http://dochub.mongodb.org/core/resyncingaverystalereplicasetmember
2018-07-18T21:31:18.519+0000 I REPL [ReplicationExecutor] going into maintenance
我必须将数据从主节点复制到辅助节点,然后重新启动mongodb辅助