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

如何在MongoDB(Ubuntu)中删除复制集中的条目,mongodb,Mongodb,我需要手动删除rs.conf()读取的复制集项 您能告诉我这些信息在哪里吗?我已经检查了etc/下的mongod.conf文件,详细信息不在其中 非常感谢我认为您应该使用从副本集中删除成员。您应该能够使用相同的过程强制升级孤立的次副本以删除剩余项 > cfg = rs.config() > cfg.members.pop() // remove the entry from the members array > rs.reconfig(cfg, {force: true})

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

您能告诉我这些信息在哪里吗?我已经检查了etc/下的mongod.conf文件,详细信息不在其中


非常感谢

我认为您应该使用从副本集中删除成员。

您应该能够使用相同的过程强制升级孤立的次副本以删除剩余项

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

感谢这个SO答案:

我无法连接到主设备,因为没有主设备,因此无法使用rs.remove()
> cfg = rs.config()
> cfg.members.pop() // remove the entry from the members array
> rs.reconfig(cfg, {force: true})