Last active
September 16, 2023 16:00
-
-
Save ravshansbox/a5c113e3d911d0a578aad81494b4bf85 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
mongo1: | |
image: mongo | |
ports: | |
- 127.0.0.1:27017:27017 | |
volumes: | |
- ./mongo1:/data/db | |
command: mongod --replSet replicaSet1 | |
mongo2: | |
image: mongo | |
ports: | |
- 127.0.0.1:27018:27017 | |
volumes: | |
- ./mongo2:/data/db | |
command: mongod --replSet replicaSet1 | |
mongo: | |
image: mongo | |
depends_on: | |
- mongo1 | |
- mongo2 | |
command: > | |
sh -c "sleep 5 && mongosh --host mongo1:27017 --eval | |
\" | |
rs.initiate({ | |
_id : 'replicaSet1', | |
members : [ | |
{ _id: 0, host: 'mongo1:27017' }, | |
{ _id: 1, host: 'mongo2:27017' } | |
] | |
}); | |
\" | |
" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment