0
votes

I need to set up a MongoDB cluster with two shards. Each shard contains 3 replica member: primary, secondary and arbiter. I already open firewall rules for mongos to talk to primary and secondary nodes but not the arbiters. I try to connect to mongos, do sh.addShard() and see that it is working properly.

My question then is do we really need to allow mongos to interact with arbiters as well? From this link we know that mongos doesn't talk to hidden members, but nothing was mentionned about arbiters.

2
My understanding is that arbiters do not have a dataset so you don't read/write to them, but I think that they do have a heartbeat, and for sure they need to be polled when the primary goes down so that you can hold an election and elect your secondary as the new primary. So you would need to allow access to it.Tiramisu
Thank @Tiramisu. But does the mongos really need to ping arbiter, as mongos has nothing to do with the election process?anhlc
Turn it as you want – every non-hidden node in a sharded cluster must be able to reach any other node. All nodes need to see the config servers for obvious reasons. All shard nodes need to see all other shard nodes for balancing. mongos needs to see all nodes in order to provide transparent failover. There is no good reason to prevent mongos to communicate with an arbiter. The only exempt of this general rule are the config servers, iirc – they only need to be able to resolve all other nodes.Markus W Mahlberg
Thanks @MarkusWMahlberg. You are right that mongos needs to see all nodes in order to provide transparent failover. In normal circumtances when all 3 replica nodes are up, mongos doesn't need to see arbiter. But when there are only one primary and one arbiter, mongos needs to check arbiter to make sure there is no network partition error.anhlc
@anhlc Which for all practical purposes sums up to "It needs to be able to see all nodes, as failover times can not be predicted."Markus W Mahlberg

2 Answers

0
votes

mongos needs to see all nodes including arbiters in order to provide transparent failover.

In normal circumtances when all 3 replica nodes (primary, secondary and arbiter) are up, mongos doesn't need to see arbiter. But when there are only one primary and one arbiter, mongos needs to check arbiter to make sure there is no network partition error in election process.

0
votes

Arbiters are there just to elect the new primary depending upon the priorities set in mongod.conf. Arbiter themselves don't store any data but they do maintain heartbeat from all the mongod servers of a replica set, and arbiters are the first ones to know if any of mongod servers of a replica set is down.