Created
January 10, 2017 05:13
-
-
Save clarkzjw/1dc6f99d9cfcf40eca1dfa01ae7b0027 to your computer and use it in GitHub Desktop.
三节点MongoDB副本集
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
version: '2' | |
services: | |
mongo1: | |
image: mongo | |
container_name: mongo1 | |
command: [mongod, --replSet, my-mongo-set, --dbpath, /data/db] | |
networks: | |
- mongo-net | |
mongo2: | |
image: mongo | |
container_name: mongo2 | |
command: [mongod, --replSet, my-mongo-set, --dbpath, /data/db] | |
networks: | |
- mongo-net | |
mongo3: | |
image: mongo | |
container_name: mongo3 | |
command: [mongod, --replSet, my-mongo-set, --dbpath, /data/db] | |
networks: | |
- mongo-net | |
mongo_rs_config: | |
image: mongo | |
container_name: mongo_rs_config | |
command: [mongo, --host, mongo1, --port, "27017", --eval, "rs.initiate( {\"_id\":\"my-mongo-set\", \"members\":[{\"_id\":0, \"host\":\"mongo1:27017\"}, {\"_id\":1, \"host\":\"mongo2:27017\"}, {\"_id\":2, \"host\":\"mongo3:27017\"}]} )"] | |
networks: | |
- mongo-net | |
networks: | |
mongo-net: | |
driver: bridge |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment