Book Image

MongoDB High Availability

By : Afshin Mehrabani
Book Image

MongoDB High Availability

By: Afshin Mehrabani

Overview of this book

Table of Contents (17 chapters)
MongoDB High Availability
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Configurations of a replica set


In our example, we will create a replica set using three members on different machines. The following is the configuration of each machine:

  • Mac OS X 10.9.2

  • Ubuntu 12.04

  • Ubuntu 12.04

We have Mac OS X on our host machine, and we use VMware Fusion to run other machines at once. The network connections between members are provided by VMware Fusion. Each mongod object will be hosted on different machines, so we will have three members on three separate machines.

The following scheme shows each machine's hostname:

  • mongod1.replicaset.com

  • mongod2.replicaset.com

  • mongod3.replicaset.com

You can set up hostnames by configuring DNS settings or adding hostnames to the hosts file. This file can be found in the /etc/ folder of the Unix operating systems.

The following diagram shows the member's network and relationships:

It's obvious that according to the situation, secondaries can become primaries. For instance, if mongod2.replicaset.com receives the majority of the votes, it...