Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.
  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
add comment

1 Answer

http://php.net/manual/en/mongo.construct.php 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 mongoosejs.com. It doens't seem like this does it. –  Alex May 7 '11 at 20:18
add comment

Your Answer

 
discard

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.