我正在跟踪this链接来部署分片群集。正如他们告诉我的第一步一样,我已经启动了三个独立的mongod实例
mongod --configsvr --replSet “cs” --dbpath mongodb/config/config-c --bind_ip localhost --port 57042
mongod --configsvr --replSet “cs” --dbpath mongodb/config/config-c --bind_ip localhost --port 57042
mongod --configsvr --replSet “cs” --dbpath mongodb/config/config-c --bind_ip localhost --port 57042
在第二步之后,当我尝试启动副本集时,就像他们提到的那样
rs.initiate( { _id: "cs", configsvr: true, members: [ { _id : 0, host : "localhost:57040" }, { _id : 1, host : "localhost:57041" }, { _id : 2, host : "localhost:57042" }]})
我遇到错误
{
"operationTime" : Timestamp(0, 0),
"ok" : 0,
"errmsg" : "Attempting to initiate a replica set with name cs, but command line reports “cs”; rejecting",
"code" : 93,
"codeName" : "InvalidReplicaSetConfig",
"$gleStats" : {
"lastOpTime" : Timestamp(0, 0),
"electionId" : ObjectId("000000000000000000000000")
},
"lastCommittedOpTime" : Timestamp(0, 0),
"$clusterTime" : {
"clusterTime" : Timestamp(0, 0),
"signature" : {
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
"keyId" : NumberLong(0)
}
}
}
为什么会出现此错误?如何解决呢?