2017-02-23 37 views
1

我正在设置分片的mongo集群。我有两个副本集,每个集包含两个节点,一个由三个配置服务器组成的副本集以及一个mongos实例。Mongos可以添加副本集,但无法连接

我已经能够添加副本设置为mongos实例:

sh.addShard("rs1/shard-rs01-s01"); 

这将返回{“OK”:1},同样是第二副本集也是如此。

然而,当我尝试做任何数据库操作,如db.test.insert(......)我收到此错误:

2017-02-23T01:17:28.599+0000 I ASIO [CatalogManagerReplacer] Connecting to shard-RS01-S01:27017 2017-02-23T01:17:28.600+0000 I ASIO [CatalogManagerReplacer] Connecting to config-01:27019 2017-02-23T01:17:28.603+0000 I ASIO [CatalogManagerReplacer] Successfully connected to config-01:27019 2017-02-23T01:17:48.600+0000 I ASIO [CatalogManagerReplacer] Failed to connect to shard-RS01-S01:27017 - ExceededTimeLimit: Operation timed out

我仔细检查了防火墙没有阻止由连接在所有系统上禁用它。对于什么是值得的,包含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 

}

回答

0

你需要初始化你的mongos。

rs.initiate({ _id: "configReplSet", configsvr: true, members: [ { _id: 0, host: "mongo-config-1:27017" }] }) 
相关问题