mongoDB-如何从复制集中删除成员,然后启动新成员?
我有一个原型,在那里我创建了一个包含3个成员的副本集。现在,我想从复制集中删除2个二级副本,并在每个二级副本上创建新的副本 从小学开始,我做了以下工作:mongoDB-如何从复制集中删除成员,然后启动新成员?,mongodb,Mongodb,我有一个原型,在那里我创建了一个包含3个成员的副本集。现在,我想从复制集中删除2个二级副本,并在每个二级副本上创建新的副本 从小学开始,我做了以下工作: rs.remove("mongohost2.domain.org:27017") rs.remove("mongohost3.domain.org:27017") 然后,当我尝试rs.status()时,它只正确地显示了集合中的主 现在,在secondary2.domain.org框中,我做了以下操作: rs.remove("mongohos
rs.remove("mongohost2.domain.org:27017")
rs.remove("mongohost3.domain.org:27017")
然后,当我尝试rs.status()时,它只正确地显示了集合中的主
现在,在secondary2.domain.org框中,我做了以下操作:
rs.remove("mongohost2.domain.org:27017")
rs.remove("mongohost3.domain.org:27017")
me@mongohost2:~$ mongo
MongoDB shell version: 2.6.5
connecting to: test
> rs.status()
{
"startupStatus" : 1,
"ok" : 0,
"errmsg" : "loading local.system.replset config (LOADINGCONFIG)"
}
> rs.initiate()
{
"ok" : 0,
"errmsg" : "local.oplog.rs is not empty on the initiating member. cannot initiate."
}
>
我在日志中找到了这个:
2014-11-25T15:11:38.876-0500 [initandlisten] waiting for connections on port 27017
2014-11-25T15:11:38.957-0500 [rsStart] warning: Failed to connect to 10.238.59.71:27017, reason: errno:111 Connection refused
2014-11-25T15:11:38.961-0500 [rsStart] replSet REMOVED
2014-11-25T15:11:38.961-0500 [rsStart] replSet info self not present in the repl set configuration:
2014-11-25T15:11:38.961-0500 [rsStart] { _id: "jls0", version: 8, members: [ { _id: 0, host: "mongohost1:27017", priority: 3.0 }, { _id: 2, host: "mongohost3.domain.org:27017" } ] }
2014-11-25T15:11:38.964-0500 [rsStart] warning: Failed to connect to 10.238.59.71:27017, reason: errno:111 Connection refused
2014-11-25T15:11:38.964-0500 [rsStart] replSet info Couldn't load config yet. Sleeping 20sec and will try again.
2014-11-25T15:11:39.237-0500 [initandlisten] connection accepted from 10.238.59.141:39443 #1 (1 connection now open)
2014-11-25T15:11:39.237-0500 [conn1] replSet set names do not match, our cmdline: jls1
2014-11-25T15:11:39.237-0500 [conn1] replSet s: jls0
2014-11-25T15:11:58.967-0500 [rsStart] warning: Failed to connect to 10.238.59.71:27017, reason: errno:111 Connection refused
2014-11-25T15:11:58.967-0500 [rsStart] replSet info Couldn't load config yet. Sleeping 20sec and will try again.
2014-11-25T15:11:59.241-0500 [conn1] replSet set names do not match, our cmdline: jls1
2014-11-25T15:11:59.241-0500 [conn1] replSet s: jls0
我还需要执行哪些其他步骤来确保此服务器现在使用自己的replicaset?
谢谢。设置新副本集时,需要调用
rs.initialize()
您也可以在初始化新数据集之前删除旧数据文件,或者仅删除存储副本设置信息的本地。*文件。好的方面:删除旧数据。但我必须运行的命令是rs.initiate()