How to configure mongo replica set with option?

I have two machines, each of which contains one instance of mongo.

I need them to work together as a set of replicas.

I use Ansible for my provision.

How can i achieve this?

+4
source share
1 answer

Here is how I did it.

I used Stouts.mongodb from Ansible Galaxy.

In playbook.yml :

 --- - name: Provision database servers hosts: dbservers sudo: true vars: mongodb_conf_replSet=rs-name/db-hostname-1:27017,db-hostname-2:27017 mongodb_shell: db-name: - rs.initiate() roles: - Stouts.mongodb 

For more information on configuring a replica set, see mongo doc .

+7
source

All Articles