【发布时间】:2016-09-06 18:13:22
【问题描述】:
我使用以下命令创建了一个带有replica set 的 MongoDB docker 容器:
docker run -d --name mongo -v /data/db:/data/db mongo --replSet name
容器开始运行。
然后我尝试initiate复制集,使用这个命令:
rs.initiate()
{
"info2" : "no configuration specified. Using a default configuration for the set",
"me" : "fa07bcdd8591:27017",
"info" : "try querying local.system.replset to see current configuration",
"ok" : 0,
"errmsg" : "already initialized",
"code" : 23
}
但它给出了错误消息“已经初始化”。
当我使用rs.status() 命令检查副本集的健康状况时
rs.status()
{
"state" : 10,
"stateStr" : "REMOVED",
"uptime" : 102,
"optime" : {
"ts" : Timestamp(1472680081, 1),
"t" : NumberLong(77)
},
"optimeDate" : ISODate("2016-08-31T21:48:01Z"),
"ok" : 0,
"errmsg" : "Our replica set config is invalid or we are not a member of it",
"code" : 93
}
它说副本集配置无效。
【问题讨论】:
-
你有没有指定任何副本集配置?
-
你有没有想过这个 sudhakar?我也遇到了同样的问题。。
标签: mongodb docker mongodb-replica-set