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.

240 lines
5.4 KiB

version: "3.4"
networks:
primary_network:
driver: overlay
ipam:
config:
- subnet: 192.168.1.0/24
#******************************************#
replica_set1_network:
driver: overlay
ipam:
config:
- subnet: 195.168.1.0/24
#******************************************#
replica_set2_network:
driver: overlay
ipam:
config:
- subnet: 196.168.2.0/24
#******************************************#
replica_set3_network:
driver: overlay
ipam:
config:
- subnet: 197.168.3.0/24
#******************************************#
replica_set4_network:
driver: overlay
ipam:
config:
- subnet: 198.168.4.0/24
#******************************************#
services:
primary1:
hostname: primary1
image: mongo:latest
ports:
- "10001:27017"
volumes:
- ./sys_files:/sys_files/
command: ["mongod", "--replSet", "rep-set1"]
networks:
primary_network:
replica_set1_network:
deploy:
restart_policy:
delay: 10s
max_attempts: 10
window: 60s
#**************
secondary1_1:
hostname: secondary1_1
image: mongo:latest
ports:
- "10002:27017"
volumes:
- ./sys_files:/sys_files
command: ["mongod", "--replSet", "rep-set1"]
# environment:
# MONGO_INITDB_ROOT_USERNAME: root
# MONGO_INITDB_ROOT_PASSWORD: "123456"
# MONGO_INITDB_DATABASE: admin
networks:
replica_set1_network:
deploy:
restart_policy:
delay: 10s
max_attempts: 10
window: 60s
#**************
secondary1_2:
hostname: secondary1_2
image: mongo:latest
ports:
- "10003:27017"
volumes:
- ./sys_files:/sys_files
command: ["mongod", "--replSet", "rep-set1"]
# environment:
# MONGO_INITDB_ROOT_USERNAME: root
# MONGO_INITDB_ROOT_PASSWORD: "123456"
# MONGO_INITDB_DATABASE: admin
networks:
replica_set1_network:
deploy:
restart_policy:
delay: 10s
max_attempts: 10
window: 60s
#*************************************************************
primary2:
hostname: primary2
image: mongo:latest
ports:
- "20001:27017"
volumes:
- ./sys_files:/sys_files
command: ["mongod", "--replSet", "rep-set2"]
networks:
primary_network:
replica_set2_network:
deploy:
restart_policy:
delay: 10s
max_attempts: 10
window: 60s
#**************
secondary2_1:
hostname: secondary2_1
image: mongo:latest
ports:
- "20002:27017"
volumes:
- ./sys_files:/sys_files
command: ["mongod", "--replSet", "rep-set2"]
networks:
replica_set2_network:
deploy:
restart_policy:
delay: 10s
max_attempts: 10
window: 60s
#**************
secondary2_2:
hostname: secondary2_2
image: mongo:latest
ports:
- "20003:27017"
volumes:
- ./sys_files:/sys_files
command: ["mongod", "--replSet", "rep-set2"]
networks:
replica_set2_network:
deploy:
restart_policy:
delay: 10s
max_attempts: 10
window: 60s
#*************************************************************
primary3:
hostname: primary3
image: mongo:latest
ports:
- "30001:27017"
volumes:
- ./sys_files:/sys_files
command: ["mongod", "--replSet", "rep-set3"]
networks:
primary_network:
replica_set3_network:
deploy:
restart_policy:
delay: 10s
max_attempts: 10
window: 60s
#**************
secondary3_1:
hostname: secondary3_1
image: mongo:latest
ports:
- "30002:27017"
volumes:
- ./sys_files:/sys_files
command: ["mongod", "--replSet", "rep-set3"]
networks:
replica_set3_network:
deploy:
restart_policy:
delay: 10s
max_attempts: 10
window: 60s
#**************
secondary3_2:
hostname: secondary3_2
image: mongo:latest
ports:
- "30003:27017"
volumes:
- ./sys_files:/sys_files
command: ["mongod", "--replSet", "rep-set3"]
networks:
replica_set3_network:
deploy:
restart_policy:
delay: 10s
max_attempts: 10
window: 60s
#*************************************************************
primary4:
hostname: primary4
image: mongo:latest
ports:
- "40001:27017"
volumes:
- ./sys_files:/sys_files
command: ["mongod", "--replSet", "rep-set4"]
networks:
primary_network:
replica_set4_network:
deploy:
restart_policy:
delay: 10s
max_attempts: 10
window: 60s
secondary4_1:
hostname: secondary4_1
image: mongo:latest
ports:
- "40002:27017"
volumes:
- ./sys_files:/sys_files
command: ["mongod", "--replSet", "rep-set4"]
networks:
replica_set4_network:
deploy:
restart_policy:
delay: 10s
max_attempts: 10
window: 60s
secondary4_2:
hostname: secondary4_2
image: mongo:latest
ports:
- "40003:27017"
volumes:
- ./sys_files:/sys_files
command: ["mongod", "--replSet", "rep-set4"]
networks:
replica_set4_network:
deploy:
restart_policy:
delay: 10s
max_attempts: 10
window: 60s