title: Failover with mongodb
body: <p>I have to setup a database that can handle failover (if one crashes the other takes over). For that, I decided to use mongodb:
  I set up a replica set with two instances. Each instance is running on a separate VM. I have several questions:</p>
  
  <ul>
  <li><p>It is recommended to use at least 3 instances in a replica set. Is it ok to use only two ?</p></li>
  <li><p>I have two instances, and then two IP addresses. Which IP should I give to my application that will need to read/write in the database ? When a database is down, how the request will be redirected to the instance that is still up ?</p></li>
  </ul>
  
  <p>Some help to get started would be great !</p>