9

If I have different webpages for differents countries and each webpage have a mongodb replicaSet of 2-3 nodes, can I use an arbiter with more than one replicaSet so it votes in all?

Or I need to initiate an arbiter per replicaSet?

Wiliam
  • 3,714
  • 7
  • 36
  • 56
  • 1
    so you have more replicaSets and each replicaSet has 2-3 nodes, right? You want one single arbiter to be in multiple replicaSets? – Andrei Sfat Aug 26 '12 at 11:23
  • 1
    the problem is that when you start a mongod instance you have to specify the -replSet parameter, thus linking a potential arbiter to that specific replicaSet. So, I don't think you can you a single arbiter on multiple replicaSets. But it wouldn't be much of a deal to start for each replicaSet a new arbiter, since arbiter instances are so lightweight. – Andrei Sfat Aug 26 '12 at 11:31
  • Yeah, that's the question. I will wait some more to see but your answers seems logic. – Wiliam Aug 26 '12 at 12:00
  • 1
    Every solution for running MongoDB across multiple data centers is a tinkered solution..don't trust in everything marketing buzz made 10gen. The replication model of MongoDB is limited and is partly flawed. –  Aug 26 '12 at 12:52
  • As @AndreiSfat suggests .. a replica set member (arbiter or data node) can only belong to a single replica set. The arbiter process is lightweight as it does not hold any data and only participates in elections. The main purpose of arbiters is for situations where you have an even number of members in your replica set and need a tie-breaking vote. – Stennie Aug 26 '12 at 13:33
  • @esaelPsnoroMoN can you argument your comment please? or share a link to any site with more info about that. Thanks. – Wiliam Aug 26 '12 at 18:12
  • I only want to maintain a copy outside my datacenter and switch to it if the datacenter fails. It's no critical if some data is lost in the switch. – Wiliam Aug 26 '12 at 18:13
  • well, first of all, I don't understand why would you want to struggle in having only one arbiter, since we have brought up some good arguments (lightweight) on having separate arbiter. You can have a single arbiter, but you cannot turn it on multiple replicaSets at once. – Andrei Sfat Aug 26 '12 at 20:25
  • @AndreiSfat oh no, that answer is ok, I want arguments for "Every solution for running MongoDB across multiple data centers is a tinkered solution.." – Wiliam Aug 26 '12 at 21:02
  • @Wiliam, I think we don't want to touch that subject and start making a discussion about that, because we would compromise your question and we don't want to close you question. Let's stick with an answer, if not mine, maybe other will bring stronger arguments than me – Andrei Sfat Aug 26 '12 at 22:24

1 Answers1

9

You can have multiple arbiter processes running on a single server (different ports). They are quite lightweight in terms of resources, as all they are doing is voting. You should look into starting the arbiters with the following arguments to keep them as lightweight as possible (from the Command Line Parameters Page):

  • --smallfiles - Use a smaller initial file size (16MB) and maximum size (512MB)
  • --nojournal - Disable journaling. In v2.0+, journaling is on by default for 64-bit

If you do not run with those options, then the arbiter will still work, but will pre-allocate data files before it knows that it is an arbiter.

Update (Jan 2018): Since this answer was written official guidance has been added to the docs for startup options of an arbiter, including options in the new config format. It can be found here.

Adam Comerford
  • 21,336
  • 4
  • 65
  • 85
  • Thanks @Adam. This is a very important question&answer for me in order to reduce the amount of server but it's a bit out of date so: is your answer still valid for MongoDB 3.4? – Delmo Mar 30 '17 at 05:46
  • @Delmo Yes, the way that arbiters work has not changed; they are still lightweight, so you can run multiple arbiters on a single instance. Double-check those parameters though, because the move to WiredTiger means they work a bit differently in recent MongoDB versions. – Vince Bowdren Jan 04 '18 at 13:17
  • Thanks @VinceBowdren Added an update to reflect the current official guidance for more recent versions – Adam Comerford Jan 04 '18 at 14:06