[英]Mongos can add replica set, but can't connect
我正在建立一个分片的mongo集群。 我有两个副本集,每个副本集包含两个节点,一个由三个配置服务器组成的副本集,以及一个mongos实例。
我已经能够将副本集添加到mongos实例:
sh.addShard("rs1/shard-rs01-s01");
这将返回{“ok”:1},第二个副本集也是如此。
但是,当我尝试执行任何数据库操作,如db.test.insert(...)时,我收到此错误:
2017-02-23T01:17:28.599 + 0000 I ASIO [CatalogManagerReplacer]连接到shard-RS01-S01:27017 2017-02-23T01:17:28.600 + 0000 I ASIO [CatalogManagerReplacer]连接到config-01:27019 2017- 02-23T01:17:28.603 + 0000 I ASIO [CatalogManagerReplacer]已成功连接到config-01:27019 2017-02-23T01:17:48.600 + 0000 I ASIO [CatalogManagerReplacer]无法连接到shard-RS01-S01:27017 - ExceededTimeLimit:操作超时
我仔细检查了防火墙是否通过在所有系统上禁用它来阻止连接。 对于它的价值,在包含mongos实例的节点上,我可以直接通过命令连接到副本集,就像使用此命令一样,无论防火墙状态如何:
mongo --host rs1/shard-rs01-s01:27017
所以我很确定它不是防火墙问题。 有人有想法么?
这是设置的分片图,如果它对任何能够提供帮助的人都有用...
mongos> db.runCommand("getShardMap")
{
"map" : {
"config" : "rs0/config-01:27019,config-02:27019,config-03:27019",
"config-01:27019" : "rs0/config-01:27019,config-02:27019,config-03:27019",
"config-02:27019" : "rs0/config-01:27019,config-02:27019,config-03:27019",
"config-03:27019" : "rs0/config-01:27019,config-02:27019,config-03:27019",
"rs0/config-01:27019,config-02:27019,config-03:27019" : "rs0/config-01:27019,config-02:27019,config-03:27019",
"rs1" : "rs1/shard-RS01-S01:27017,shard-RS01-S02:27017",
"rs1/shard-RS01-S01:27017,shard-RS01-S02:27017" : "rs1/shard-RS01-S01:27017,shard-RS01-S02:27017",
"rs2" : "rs2/shard-RS02-S03:27017,shard-RS02-S04:27017",
"rs2/shard-RS02-S03:27017,shard-RS02-S04:27017" : "rs2/shard-RS02-S03:27017,shard-RS02-S04:27017",
"shard-RS01-S01:27017" : "rs1/shard-RS01-S01:27017,shard-RS01-S02:27017",
"shard-RS01-S02:27017" : "rs1/shard-RS01-S01:27017,shard-RS01-S02:27017",
"shard-RS02-S03:27017" : "rs2/shard-RS02-S03:27017,shard-RS02-S04:27017",
"shard-RS02-S04:27017" : "rs2/shard-RS02-S03:27017,shard-RS02-S04:27017"
},
"ok" : 1
}
你需要初始化你的mongos。
rs.initiate( { _id: "configReplSet", configsvr: true, members: [ { _id: 0, host: "mongo-config-1:27017" }] } )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.