Skip to content

Instantly share code, notes, and snippets.

@rubanraj54
Created January 13, 2018 17:56
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save rubanraj54/f1262c8b6fc4f755188231fe30380dcc to your computer and use it in GitHub Desktop.
Save rubanraj54/f1262c8b6fc4f755188231fe30380dcc to your computer and use it in GitHub Desktop.
Simple MongoDB cluster using docker compose (3 node cluster)
version: '3'
services:
node1:
image: mongo
ports:
- 30001:27071
volumes:
- $HOME/mongoclusterdata/node1:/data/db
networks:
- mongocluster
command: mongod --replSet comments
node2:
image: mongo
ports:
- 30002:27071
volumes:
- $HOME/mongoclusterdata/node2:/data/db
networks:
- mongocluster
command: mongod --replSet comments
depends_on :
- node1
node3:
image: mongo
ports:
- 30003:27071
volumes:
- $HOME/mongoclusterdata/node3:/data/db
networks:
- mongocluster
command: mongod --replSet comments
depends_on :
- node2
networks:
mongocluster:
driver: bridge
@KSTARK007
Copy link

ports for mongo is 27017 and not 27071
Please correct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment