Skip to content

Commit

Permalink
Fixed post titles to be h2
Browse files Browse the repository at this point in the history
  • Loading branch information
eko committed Dec 4, 2017
1 parent e0d78ab commit b0b3a31
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Expand Up @@ -22,7 +22,7 @@ I recently had the opportunity to deploy a MongoDB server on Amazon Web Services

To automate the creation of EC2 machines, I used [Terraform](https://www.terraform.io/) (and its `aws` provider) as well as Ansible](https://www.ansible.com/) for provisioning. This article describes the technical logic that we set up to achieve this.

# Context
## Context

So we have a MongoDB cluster composed of three EC2 instances (say, `t2. large` type).

Expand All @@ -43,7 +43,7 @@ The definition of a server (primary or secondary) is done through a majority ele

It is therefore impossible to define this replication model with only two servers in your cluster.

# Terraform: server creation
## Terraform: server creation

So let's move on to the creation of machines on AWS: we have made the choice of [Terraform](https://www.terraform.io){"target":"_blank"} for this part, a resource automation tool.

Expand Down Expand Up @@ -197,7 +197,7 @@ You will notice that we allow here all the provenances in the `cidr_blocks` entr

We are now finished with the Terraform part: we are able to create a MongoDB (EC2) server on AWS but we still have to provision the server.

# Ansible: provisioning
## Ansible: provisioning

To provision the MongoDB server, we use an Ansible playbook. Here is the definition of the playbook:

Expand Down Expand Up @@ -390,10 +390,10 @@ rs0:PRIMARY> rs.conf()

Thus, no more doubt about your configuration. You also have the option of giving weight to certain servers that will allow you to influence the elections of a new primary server in case of a failure on your cluster via the `priority` property.

# Conclusion
## Conclusion

Deploying a MongoDB cluster with an active replication on a specified infrastructure via Terraform code and provisioned with Ansible is really very simple. Indeed, MongoDB makes things much easier for us because it only takes a few lines of configuration to activate replication.

The whole logic of primary server election and re-definition is managed by MongoDB.

To go further with MongoDB replication, I invite you to browse the official MongoDB documentation which explains very well, with diagrams, the operation and the various configuration parameters available to configure your replicas:[https://docs.mongodb.com/v3.0/core/replication-introduction/#replication-introduction](https://docs.mongodb.com/v3.0/core/replication-introduction/#replication-introduction){"target":"_blank"}.
To go further with MongoDB replication, I invite you to browse the official MongoDB documentation which explains very well, with diagrams, operation and the various configuration parameters available to configure your replicas:[https://docs.mongodb.com/v3.0/core/replication-introduction/#replication-introduction](https://docs.mongodb.com/v3.0/core/replication-introduction/#replication-introduction).
Expand Up @@ -22,7 +22,7 @@ J'ai récemment eu l'occasion de déployer un serveur MongoDB sur Amazon Web Ser

Pour l'automatisation de la création des machines EC2, j'ai utilisé [Terraform](https://www.terraform.io/) (et son provider `aws`) ainsi que [Ansible](https://www.ansible.com/) pour le provisionnement. Cet article décrit la logique technique que nous avons mis en place pour y arriver.

# Contexte
## Contexte

Nous avons donc un cluster MongoDB composé de trois instances EC2 (disons de type `t2.large`).

Expand All @@ -43,7 +43,7 @@ La définition d'un serveur (primaire ou secondaire) se fait via le biais d'une

Impossible donc de définir ce modèle de réplication avec seulement deux serveurs dans votre cluster.

# Terraform : création des serveurs
## Terraform : création des serveurs

Passons maintenant à la création des machines sur AWS : nous avons fait le choix de ![Terraform](https://www.terraform.io){"target":"_blank"} pour cette partie, un outil d'automatisation de ressources.

Expand Down Expand Up @@ -197,7 +197,7 @@ Vous noterez que l'on autorise ici toutes les provenances dans l'entrée `cidr_b

Nous en avons terminé avec la partie Terraform : nous sommes capables de créer un serveur MongoDB (EC2) sur AWS mais il nous reste à provisionner le serveur.

# Ansible : provisioning
## Ansible : provisioning

Pour provisionner le serveur MongoDB, nous utilisons un playbook Ansible. Voici la définition du playbook :

Expand Down Expand Up @@ -390,10 +390,10 @@ rs0:PRIMARY> rs.conf()

Ainsi, plus de doute sur votre configuration. Vous avez également la possibilité de donner du poids à certains serveur, ce qui permettra d'influencer les élections d'un nouveau serveur primaire en cas de panne sur votre cluster via la propriété `priority`.

# Conclusion
## Conclusion

Déployer un cluster MongoDB avec un réplication active sur une infrastructure spécifiée via du code Terraform et provisionnée avec Ansible est vraiment très simple. En effet, MongoDB nous facilite beaucoup les choses car il ne suffit que de quelques lignes de configuration pour activer la réplication.

Toute la logique d'élection et de re-définition de serveur primaire est gérée par MongoDB.

Pour aller plus loin au niveau de la réplication MongoDB, je vous invite à parcourir la documentation officielle de MongoDB qui explique très bien, avec des schémas, le fonctionnement et les différents paramètres de configuration disponibles pour configurer au mieux vos réplicas : [https://docs.mongodb.com/v3.0/core/replication-introduction/#replication-introduction](https://docs.mongodb.com/v3.0/core/replication-introduction/#replication-introduction){"target":"_blank"}
Pour aller plus loin au niveau de la réplication MongoDB, je vous invite à parcourir la documentation officielle de MongoDB qui explique très bien, avec des schémas, le fonctionnement et les différents paramètres de configuration disponibles pour configurer au mieux vos réplicas : [https://docs.mongodb.com/v3.0/core/replication-introduction/#replication-introduction](https://docs.mongodb.com/v3.0/core/replication-introduction/#replication-introduction).

0 comments on commit b0b3a31

Please sign in to comment.