如何在MongoDB (Ubuntu)中删除复制集中的条目



我需要手动删除rs.conf()读取的复制集项。

 {
       "_id" : 1,
       "name" : "10.2.0.4:27017",
       "health" : 0,
       "state" : 8,
       "stateStr" : "(not reachable/healthy)",
       "uptime" : 0,
       "optime" : {
               "t" : 0,
               "i" : 0
       },
       "optimeDate" : ISODate("1970-01-01T00:00:00Z"),
       "lastHeartbeat" : ISODate("2014-06-04T09:08:39Z"),
       "lastHeartbeatRecv" : ISODate("1970-01-01T00:00:00Z"),
       "pingMs" : 0
}

你能告诉我这些信息在哪里吗,我检查了etc/下的mongod.conf文件,细节不在里面。

多谢

我认为你应该使用rs.remove(ip)从复制集中删除一个成员。

您应该能够使用相同的过程来强制提升孤立的次要条目以删除剩余的条目。

> cfg = rs.config()
> cfg.members.pop() // remove the entry from the members array
> rs.reconfig(cfg, {force: true})

MongoDB docs: Reconfigure Replica Set with Unavailable Members
由于这个SO答案:从辅助节点将辅助节点提升到主节点

最新更新