MongoDB副本集成员状态为“其他". [英] MongoDB Replica Set Member State is "OTHER"
本文介绍了MongoDB副本集成员状态为“其他".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
三名成员,主要成员和二级-第三个是"OTHER"-我找不到关于该状态的任何信息,不确定该怎么做,我已经重新启动了实例,但是总是出现相同的情况.在该状态下找不到任何文档.
Three members, primary & secondary - and a third one that's "OTHER" - I can't find any info on that state, not sure what to do, I've restarted the instance, but it always comes-up the same. Can find no documentation on that state.
我是副本集的新手,我们将不胜感激.
I'm new to replica sets - and any help would be appreciated.
推荐答案
配置未正确设置.
您可以使用以下命令进行初始化:
You can use following command to init:
rs.initiate({
_id: "rs0",
version: 1,
members: [
{ _id: 0, host : "localhost:27017" }
]
}
)
如果您已经启动,则可能会收到像我这样的错误消息:
If you have already initiated, you may get the error msg like me:
singleNodeRepl:OTHER> rs.initiate({ _id: "rs0", members: [ { _id: 0, host : "localhost:27017" } ] } )
{
"info" : "try querying local.system.replset to see current configuration",
"ok" : 0,
"errmsg" : "already initialized",
"code" : 23,
"codeName" : "AlreadyInitialized"
}
解决方案是reconf
mongo:
The solution is to reconf
the mongo:
singleNodeRepl:OTHER> rsconf = rs.conf()
singleNodeRepl:OTHER> rsconf.members = [{_id: 0, host: "localhost:27017"}]
[ { "_id" : 0, "host" : "localhost:27017" } ]
singleNodeRepl:OTHER> rs.reconfig(rsconf, {force: true})
{ "ok" : 1 }
singleNodeRepl:OTHER>
singleNodeRepl:SECONDARY>
singleNodeRepl:PRIMARY>
这篇关于MongoDB副本集成员状态为“其他".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文