Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
  1. Install Mongo on A. Start the server: $ mongod --rest --replSet myset
  2. rs.initiate() on A.
  3. Install Mongo on B. Start the server: $ mongod --rest --replSet myset
  4. Connect to A and add B to the set: rs.add("B");
  5. Set up C as the Arbiter: $ mongod --rest --replSet myset --oplogSize
  6. Connect to A and add C as an arbiter: rs.add( { host:”C”, arbiterOnly:true }

Alright, my question is:

What Mongo server does my web server connect to? Before replica set, it's very simple. I just give it a host, user, pass, and the web server connects perfectly. But with all of this set up, how does the web server know whether to point to A, or to B, or to C?

I'm guessing that the web server should always point to C, and it will handle everything magically?

share|improve this question will help you even if you are not using PHP. You can connect to any server in the RS, the rest is the driver's role (and every driver does it). Specifying several to connect to makes it possible for the driver to connect to the RS should one server fail.

share|improve this answer
I'm using It doens't seem like this does it. – Alex May 7 '11 at 20:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.