错误初始化MongoDB的复制品泊坞容器

问题描述:

我创建了一个MongoDB的泊坞窗容器中,加一个replica set,使用这个命令:错误初始化MongoDB的复制品泊坞容器

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 
} 

设置副本的健康报告说,副本集的配置是无效的。

+0

你有没有指定的任何副本集的配置呢? –

+0

你有没有想过这个sudhakar?我一直有同样的问题.. –

看起来你没有指定任何副本集配置。

replica set initiate example

rs.initiate(
 
    { 
 
     _id: "myReplSet", 
 
     version: 1, 
 
     members: [ 
 
     { _id: 0, host : "mongodb0.example.net:27017" }, 
 
     { _id: 1, host : "mongodb1.example.net:27017" }, 
 
     { _id: 2, host : "mongodb2.example.net:27017" } 
 
     ] 
 
    } 
 
)