Tag Archives: MongoDB

Large-scale continuous deployment Jenkins tutorial for hybrid clouds


Are you at the Jenkins conference this week? We’re excited to be there as a sponsor and meet many of you who work on continuous deployments (CD). Our goal is to help you achieve CD without writing scripts or doing manual grunt work. To that end, we want to showcase full CD automation for your use-cases using Jenkins and ElasticBox. A simple Todo Node.js application tutorial demonstrates the CD automation in this post. Read More

Do it like you know Puppet


Why integrate Puppet deployments with an external solution like ElasticBox? Our CTO and Co-Founder, Alberto Arias Maestro, answered this very question at a recent Puppet meetup and demoed a full-on Puppet deployment. Read More

MongoDB and Splunk – Intelligent Monitoring

One of the biggest benefits of ElasticBox is that Boxes are stackable and reusable. This means that you can write a Box once, and then reuse it a lot of times. This can be particularly useful when you start modeling your low level infrastructure as ElasticBox Boxes.

Introducing Splunk
Splunk is a very popular data management application. According to their website, “Splunk is an application that indexes and makes searchable data from any app, server or network device in real time including logs, config files, messages, alerts, scripts and metrics”. Read More

Deploying a MongoDB Cluster with ElasticBox

With ElasticBox, you can easily deploy a self replicating MongoDB cluster in just a few minutes. In order to accommodate ElasticBox’s data needs, we rely on MongoDB clusters that run on two public clouds and one private data center.

This way we can provide redundancy, high availability and excellent read and write performance around the world. Using ElasticBox, and our concept of Boxes, which are application or infrastructure components made available as a service, we can consistently deploy a MongoDB cluster in just a matter of minutes on any of our Cloud Providers.

To get started deploying MongoDB clusters on ElasticBox, sign up today for our free account! If you’re interested in other resources on MongoDB, check out how you can easily use Splunk to monitor MongoDB using ElasticBox.

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!