Я бы хотел сделать кластер монго с несколькими монго-роутерами (монго) с одним осколком (монгодом), как показано на рисунке.
Итак, я сделал два роутера монго под названием «монгорутер-1», «монгороутер-2», а также сделал один осколок с именем «монгод».
В mongorouter-1 я хорошо добавил «mongod» с помощью этой команды.
sh.addShard("mongod:27017")
Она работает хорошо, но в mongorouter-2 эта команда выдает ошибку, как
mongos> sh.addShard("mongod:27017")
{
"ok" : 0,
"errmsg" : "E11000 duplicate key error collection: admin.system.version index: _id_ dup key: { : \"shardIdentity\" }",
"code" : 11000,
"codeName" : "DuplicateKey",
"operationTime" : Timestamp(1558591937, 1),
"$clusterTime" : {
"clusterTime" : Timestamp(1558591937, 1),
"signature" : {
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
"keyId" : NumberLong(0)
}
}
}
В mongorouter-1 sh.status это
mongos> sh.status()
--- Sharding Status ---
sharding version: {
"_id" : 1,
"minCompatibleVersion" : 5,
"currentVersion" : 6,
"clusterId" : ObjectId("5ce6683cc490bfc9325389cb")
}
shards:
{ "_id" : "shard0000", "host" : "mongod:27017", "state" : 1 }
active mongoses:
"4.0.6" : 1
autosplit:
Currently enabled: yes
balancer:
Currently enabled: yes
Currently running: no
Failed balancer rounds in last 5 attempts: 0
Migration Results for the last 24 hours:
No recent migrations
databases:
{ "_id" : "config", "primary" : "config", "partitioned" : true }
, а в mongorouter-2 sh.status это
mongos> sh.status()
--- Sharding Status ---
sharding version: {
"_id" : 1,
"minCompatibleVersion" : 5,
"currentVersion" : 6,
"clusterId" : ObjectId("5ce668176a4dcc52fd230ac9")
}
shards:
active mongoses:
autosplit:
Currently enabled: yes
balancer:
Currently enabled: yes
Currently running: no
Failed balancer rounds in last 5 attempts: 0
Migration Results for the last 24 hours:
No recent migrations
databases:
{ "_id" : "config", "primary" : "config", "partitioned" : true }
Я не знаю, как сделать несколько монгоМаршрутизаторы подключены только к одному шарду.
Если вы знаете решение, помогите мне.Заранее спасибо.