app-root
-> (src)
-> docker-compose.yml
-> scripts
-> setupReplicaSet.sh
Add the following to your /etc/hosts
file in order to connect to the replica set locally
127.0.0.1 mongo1
127.0.0.1 mongo2
127.0.0.1 mongo3
$ sudo chmod 755 ./scripts/setupReplicaSet.sh
$ sudo docker-compose.yml up -d
Based on the hostnames and ports in the docker-compose.yml
and setupReplicaSet.sh
files
mongodb://mongo1:27017,mongo2:27018,mongo3:27019/<DB-NAME-HERE>?replicaSet=rs0