本文介绍了如何将MongoDB副本集转换为独立服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑一下,我有4个复制集,配置如下:

Consider, I have 4 replicate sets and the config is as follows:

{
 "_id": "rs_0",
 "version": 5,
 "members" : [
  {"_id": 1, "host": "127.0.0.1:27001"},
  {"_id": 2, "host": "127.0.0.1:27002"},
  {"_id": 3, "host": "127.0.0.1:27003"},
  {"_id": 4, "host": "127.0.0.1:27004"}
 ]
}

我可以使用mongo --port <port>

有些文档可在将独立副本转换为副本集,但是有人可以告诉我如何从副本集中转换回独立副本吗?

There are documents for getting information on Convert a Standalone to a Replica Set, but can anyone tell me how to convert back to standalone from replica set?

推荐答案

只需从副本集(rs.remove('host:port'))中删除主机,不使用replSet参数重新启动它即可,并且它又是独立的.

Just remove a host from replica set (rs.remove('host:port')), relaunch it without replSet parameter and it's standalone again.

这篇关于如何将MongoDB副本集转换为独立服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 08:58