'No common protocol found when add shard in local network
I'm trying to build a small cluster using mongodb sharding. I tried with everything in localhost and it works perfect. But when I try on my local network where there are two nodes, node1 and node2, it does not work. In both nodes, mongod are started to serve as shard. In node1, config server and mongos are started. All listening 0.0.0.0 with exclusively allocated ports.
I can connect and do things with both nodes. When I use mongo to login mongos in node1, I can add Node1 mongod as shard but when I try to add Node2, an error occurs:
mongos> sh.addShard("<ip of node2 in local network>")
{ "ok" : 0, "errmsg" : "No common protocol found.", "code" : 126 }
I did some searching but few documentation is about this error.
mongo addShard "No common protocol found" errmsg 126 shows the same error but it does not seem helpful.
Solution 1:[1]
Couple of things to check
a) Are you using the same version of Mongod on all machines.
b) Are you using same kind of storageEngine on all machines.
Solution 2:[2]
Our problem should have been obvious, but wasn't.
We simply forgot to configure ports here, so the :27000 was missing:
db.shards.updateOne({ "_id" : "shard0000" }, { $set : { "host" : "oururl.foo:27000" } })
db.shards.updateOne({ "_id" : "shard0001" }, { $set : { "host" : "oururl.foo:27000" } })
db.shards.updateOne({ "_id" : "shard0002" }, { $set : { "host" : "oururl.foo:27000" } })
db.shards.updateOne({ "_id" : "shard0003" }, { $set : { "host" : "oururl.foo:27000" } })
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | user325643 |
Solution 2 | Joshua Grigonis |