我从这里发布了这个问题
我在kubernetes环境中运行分片mongodb,有3个分片,每个分片上有3个实例.出于某些原因,我的mongodb实例已被重新安排到另一台机器上.
问题是当一个mongodb实例被重新安排到另一个实例时,replica config
它将被无效.导致此错误如下.
> rs.status() { "state" : 10, "stateStr" : "REMOVED", "uptime" : 2110, "optime" : Timestamp(1448462710, 6), "optimeDate" : ISODate("2015-11-25T14:45:10Z"), "ok" : 0, "errmsg" : "Our replica set config is invalid or we are not a member of it", "code" : 93 } >
这是配置
> rs.config().members [ { "_id" : 0, "host" : "mongodb-shard2-service:27038", "arbiterOnly" : false, "buildIndexes" : true, "hidden" : false, "priority" : 1, "tags" : { }, "slaveDelay" : 0, "votes" : 1 }, { "_id" : 1, "host" : "shard2-slave2-service:27039", "arbiterOnly" : false, "buildIndexes" : true, "hidden" : false, "priority" : 1, "tags" : { }, "slaveDelay" : 0, "votes" : 1 }, { "_id" : 2, "host" : "shard2-slave1-service:27033", "arbiterOnly" : false, "buildIndexes" : true, "hidden" : false, "priority" : 1, "tags" : { }, "slaveDelay" : 0, "votes" : 1 } ]
以及 db.serverStatus()
重新安排的mongodb实例的示例
> db.serverStatus() { "host" : "mongodb-shard2-master-ofgrb", "version" : "3.0.7", "process" : "mongod", "pid" : NumberLong(8),
我希望我有意义..因为,我很快就会在现场制作中使用它...谢谢!!