mongo
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

120 lines
2.8 KiB

version: "3.7"
networks:
mongo-net:
external: true
services:
node1:
image: mongo:4.0
command: /usr/bin/mongod --config /etc/mongod.conf
labels:
node1.description: "node1"
networks:
mongo-net:
ipv4_address: 192.168.1.11
expose:
- "27017"
environment:
TERM: xterm
volumes:
- /etc/localtime:/etc/localtime:ro
- /var/lab/mongo_replica:/data/db
- /var/lab/swarmexec/mongo.key:/data/mongo.key
- /var/lab/swarmexec/mongod2.conf:/etc/mongod.conf
- /var/lab/mongo_replica.log:/var/log/mongodb/mongod.log
deploy:
mode: replicated
replicas: 1
endpoint_mode: vip
restart_policy:
condition: on-failure
resources:
limits:
cpus: '1'
memory: 512M
reservations:
cpus: '0.50'
memory: 512M
placement:
constraints:
- node.id == ${MONGOnode1}
labels:
node1.description: "node1"
node2:
image: mongo:4.0
command: /usr/bin/mongod --config /etc/mongod.conf
labels:
node2.description: "node2"
networks:
mongo-net:
ipv4_address: 192.168.1.12
expose:
- "27017"
environment:
TERM: xterm
volumes:
- /etc/localtime:/etc/localtime:ro
- /var/lab/mongo_replica:/data/db
- /var/lab/swarmexec/mongo.key:/data/mongo.key
- /var/lab/swarmexec/mongod2.conf:/etc/mongod.conf
- /var/lab/mongo_replica.log:/var/log/mongodb/mongod.log
deploy:
mode: replicated
replicas: 1
endpoint_mode: vip
restart_policy:
condition: on-failure
resources:
limits:
cpus: '1'
memory: 512M
reservations:
cpus: '0.50'
memory: 512M
placement:
constraints:
- node.id == ${MONGOnode2}
labels:
node2.description: "node2"
node3:
image: mongo:4.0
command: /usr/bin/mongod --config /etc/mongod.conf
labels:
node3.description: "node3"
networks:
mongo-net:
ipv4_address: 192.168.1.13
expose:
- "27017"
environment:
TERM: xterm
volumes:
- /etc/localtime:/etc/localtime:ro
- /var/lab/mongo_replica:/data/db
- /var/lab/swarmexec/mongo.key:/data/mongo.key
- /var/lab/swarmexec/mongod2.conf:/etc/mongod.conf
- /var/lab/mongo_replica.log:/var/log/mongodb/mongod.log
deploy:
mode: replicated
replicas: 1
endpoint_mode: vip
restart_policy:
condition: on-failure
resources:
limits:
cpus: '1'
memory: 512M
reservations:
cpus: '0.50'
memory: 512M
placement:
constraints:
- node.id == ${MONGOnode3}
labels:
node3.description: "node3"