## Directory Structure ``` app-root -> (src) -> docker-compose.yml -> scripts -> setupReplicaSet.sh ``` ## Map Hostnames 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 ``` ## Start up ```bash $ sudo chmod 755 ./scripts/setupReplicaSet.sh $ sudo docker-compose.yml up -d ``` ## Connection URI Based on the hostnames and ports in the `docker-compose.yml` and `setupReplicaSet.sh` files ``` mongodb://mongo1:27017,mongo2:27018,mongo3:27019/?replicaSet=rs0 ```