Public | Automated Build

Last pushed: 2 years ago
Short Description
Short description is empty for this repo.
Full Description

Run mongo DBs with replSet command.

sudo docker run -d --name mongo1 -p 1111:27017 vfarcic/mongo --replSet rs0
sudo docker run -d --name mongo2 -p 2222:27017 vfarcic/mongo --replSet rs0
sudo docker run -d --name mongo3 -p 3333:27017 vfarcic/mongo --replSet rs0

Wait until MongoDB is up and running. That can be seen by monitoring logs. When "waiting for connections on port 27017" is output, DB is ready.

sudo docker logs -f mongo1
sudo docker logs -f mongo2
sudo docker logs -f mongo3

In one of the instances, run following (change IPs to those of your host):

sudo docker exec mongo1 su - mongodb -c '/'

This will set replica with first host as primary, second and secondary and the third one ar arbiter.

Docker Pull Command
Source Repository

Comments (0)