Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- version: '3.2'
- services:
- shard1:
- hostname: shard1
- deploy:
- placement:
- constraints:
- - node.labels.label == server1
- image: mongo
- command: mongod --shardsvr --replSet mongo_shard --dbpath /data/db --bind_ip 0.0.0.0 --port 9603
- ports:
- - 9603:9603
- volumes:
- - /etc/localtime:/etc/localtime:ro
- - ./data1:/data/db
- shard2:
- hostname: shard2
- deploy:
- placement:
- constraints:
- - node.labels.label == server2
- image: mongo
- command: mongod --shardsvr --replSet mongo_shard --dbpath /data/db --bind_ip 0.0.0.0 --port 9604
- ports:
- - 9604:9604
- volumes:
- - /etc/localtime:/etc/localtime:ro
- - ./data2:/data/db
- shard3:
- hostname: shard3
- deploy:
- placement:
- constraints:
- - node.labels.label == server4
- image: mongo
- command: mongod --shardsvr --replSet mongo_shard --dbpath /data/db --bind_ip 0.0.0.0 --port 9605
- ports:
- - 9605:9605
- volumes:
- - /etc/localtime:/etc/localtime:ro
- - ./data3:/data/db
- config1:
- hostname: config1
- deploy:
- placement:
- constraints:
- - node.labels.label == server1
- image: mongo
- command: mongod --configsvr --replSet mongo_config --dbpath /data/db --bind_ip 0.0.0.0 --port 27017
- ports:
- - 27017:27017
- volumes:
- - /etc/localtime:/etc/localtime:ro
- - ./config1:/data/db
- config2:
- hostname: config2
- deploy:
- placement:
- constraints:
- - node.labels.label == server2
- image: mongo
- command: mongod --configsvr --replSet mongo_config --dbpath /data/db --bind_ip 0.0.0.0 --port 27027
- ports:
- - 27027:27027
- volumes:
- - /etc/localtime:/etc/localtime:ro
- - ./config2:/data/db
- config3:
- hostname: config3
- deploy:
- placement:
- constraints:
- - node.labels.label == server4
- image: mongo
- command: mongod --configsvr --replSet mongo_config --dbpath /data/db --bind_ip 0.0.0.0 --port 27037
- ports:
- - 27037:27037
- volumes:
- - /etc/localtime:/etc/localtime:ro
- - ./config3:/data/db
- mongos1:
- hostname: mongos1
- image: mongo
- depends_on:
- - config1
- - config2
- command: mongos --configdb mongo_config/config1:27017,config2:27027,config3:27037 --bind_ip 0.0.0.0 --port 9606
- ports:
- - 9606:9606
- volumes:
- - /etc/localtime:/etc/localtime:ro
- mongos2:
- hostname: mongos2
- image: mongo
- depends_on:
- - config1
- - config2
- command: mongos --configdb mongo_config/config1:27017,config2:27027,config3:27037 --bind_ip 0.0.0.0 --port 9607
- ports:
- - 9607:9607
- volumes:
- - /etc/localtime:/etc/localtime:ro
- # For Mongo Config
- # {
- # _id: "mongo_config",
- # configsvr: true,
- # members: [
- # { _id : 0, host : "config1:27017" },
- # { _id : 1, host : "config2:27027" },
- # { _id : 2, host : "config3:27037" }
- # ]
- # }
- # For Mongo Shard
- # {
- # _id: "mongo_shard",
- # members: [
- # { _id : 0, host : "shard1:9603" },
- # { _id : 1, host : "shard2:9604" },
- # { _id : 2, host : "shard3:9605" }
- # ]
- # }
Add Comment
Please, Sign In to add comment