Our founders, back in the day, ย were part of the .NET framework team atย Microsoft. So it’s no surpriseย that their first version of ElasticBox was written on C#, .NET framework and SQL Server.
Fast forward to 2012. As the ElasticBox vision crystallized,ย we wanted a robust, scalableย architecture toย match ourย vision. So we reevaluated allย theย existingย technologies.
Among other things, we decided to move from a relational database model to a document based approach. The main reason was because we wantedย toย store hierarchical data and be able toย version it.
Today, to accommodate our data needs, ElasticBox relies on MongoDB clusters, which we run on three separate providers–two public, one private. Thanks to ElasticBox, we can now deploy our MongoDB cluster in a matter ofย minutes.
The Basics
What is MongoDB?ย MongoDBย is an open-source document store database.
Why would you want to cluster MongoDB?ย To provide redundancy and high-availability for production deployments.
How We Use MongoDB
In our case, MongoDB is using a replica set model. A replica set is a group of MongoDBย instances that host the same data set. One MongoDB, the primary, receives all write operations. All other instances, secondaries, apply operations from the primary so that they have the same data set.
Theย primaryย accepts all write operations from clients. Replica sets can have only one primary. Because only one member can accept write operations, replica sets provideย strict consistency.
Deploying MongoDB through ElasticBox
ElasticBox provides a default MongoDB box that’s available to the public. It deploys a standalone instance of the MongoDB server. Our MongoDB production box very closely resembles the defaultย box, minus a few configuration settings required for our production scenario.
While the default MongoDB box configuration is suited for development purposes, it needs to be configured further to use in production. To configure the MongoDB defaultย box for production use,ย follow the steps below:
Step 1.ย Create a new box called MongoDB Replica. Add a box variable for theย MongoDB Serverย (this is to useย the default box settings).
Step 2.ย Add a text variableย REPLICA_SETย to hold the replica setย name. This value must be shared between all the members of the cluster.
Step 3.ย Expand the MongoDB Server box.ย Edit itsย file variableย COMMON_YAMLย and paste the following:
mongodb::replica_set: {{ REPLICA_SET }}
mongodb::key_file: /etc/mongod.key
This file will be used by hiera to pass arguments to puppet automatically without modifying the existing puppet default.pp file.
Step 4.ย Add a binding named primary of typeย MongoDB Replicaย (the box you just created).
Step 5.ย Add an install script. Getย the scriptย here.
Step 6.ย Add a start script. Getย the scriptย here.
When you deploy the box withoutย aย binding, it creates a cluster for you with an initial configuration. On the other hand, if you bind to an existing instance, it adds the instance to the existing cluster!
There, you have it, a MongoDB cluster in a few easy steps!














