mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-02-17 14:42:26 +08:00
1.MongoDB、Redis兼容集群模式
2.离线数据接口化访问
This commit is contained in:
196
docker/3rd/mongo/mongo_cluster/docker-compose.yaml
Normal file
196
docker/3rd/mongo/mongo_cluster/docker-compose.yaml
Normal file
@@ -0,0 +1,196 @@
|
||||
version: '3'
|
||||
services:
|
||||
mongo_shard1:
|
||||
restart: always
|
||||
image: mongo:5.0.5
|
||||
container_name: mongo_shard1
|
||||
ports:
|
||||
- "27118:27018/tcp"
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime
|
||||
- /etc/timezone:/etc/timezone
|
||||
- ./data/shard1:/data/db
|
||||
command: mongod --shardsvr --replSet shard1
|
||||
privileged: true
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '4.00'
|
||||
memory: 512M
|
||||
|
||||
mongo_shard2:
|
||||
restart: always
|
||||
image: mongo:5.0.5
|
||||
container_name: mongo_shard2
|
||||
ports:
|
||||
- "27218:27018/tcp"
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime
|
||||
- /etc/timezone:/etc/timezone
|
||||
- ./data/shard2:/data/db
|
||||
command: mongod --shardsvr --replSet shard2
|
||||
privileged: true
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '4.00'
|
||||
memory: 512M
|
||||
|
||||
mongo_shard3:
|
||||
restart: always
|
||||
image: mongo:5.0.5
|
||||
container_name: mongo_shard3
|
||||
ports:
|
||||
- "27318:27018/tcp"
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime
|
||||
- /etc/timezone:/etc/timezone
|
||||
- ./data/shard3:/data/db
|
||||
command: mongod --shardsvr --replSet shard3
|
||||
privileged: true
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '4.00'
|
||||
memory: 512M
|
||||
|
||||
mongo_config1:
|
||||
restart: always
|
||||
image: mongo:5.0.5
|
||||
container_name: mongo_config1
|
||||
ports:
|
||||
- "27119:27019/tcp"
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime
|
||||
- /etc/timezone:/etc/timezone
|
||||
- ./data/config1:/data/configdb
|
||||
command: mongod --configsvr --replSet config
|
||||
depends_on:
|
||||
- mongo_shard1
|
||||
- mongo_shard2
|
||||
- mongo_shard3
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '1.00'
|
||||
memory: 256M
|
||||
|
||||
mongo_config2:
|
||||
restart: always
|
||||
image: mongo:5.0.5
|
||||
container_name: mongo_config2
|
||||
ports:
|
||||
- "27219:27019/tcp"
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime
|
||||
- /etc/timezone:/etc/timezone
|
||||
- ./data/config2:/data/configdb
|
||||
command: mongod --configsvr --replSet config
|
||||
depends_on:
|
||||
- mongo_shard1
|
||||
- mongo_shard2
|
||||
- mongo_shard3
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '1.00'
|
||||
memory: 256M
|
||||
|
||||
mongo_config3:
|
||||
restart: always
|
||||
image: mongo:5.0.5
|
||||
container_name: mongo_config3
|
||||
ports:
|
||||
- "27319:27019/tcp"
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime
|
||||
- /etc/timezone:/etc/timezone
|
||||
- ./data/config3:/data/configdb
|
||||
command: mongod --configsvr --replSet config
|
||||
depends_on:
|
||||
- mongo_shard1
|
||||
- mongo_shard2
|
||||
- mongo_shard3
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '1.00'
|
||||
memory: 256M
|
||||
|
||||
mongo_mongos1:
|
||||
restart: always
|
||||
image: mongo:5.0.5
|
||||
container_name: mongo_mongos1
|
||||
ports:
|
||||
- "27117:27017/tcp"
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime
|
||||
- /etc/timezone:/etc/timezone
|
||||
command: mongos --bind_ip_all --configdb config/mongo_config1:27019,mongo_config2:27019,mongo_config3:27019
|
||||
depends_on:
|
||||
- mongo_config1
|
||||
- mongo_config2
|
||||
- mongo_config3
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '2.00'
|
||||
memory: 128M
|
||||
|
||||
mongo_mongos2:
|
||||
restart: always
|
||||
image: mongo:5.0.5
|
||||
container_name: mongo_mongos2
|
||||
ports:
|
||||
- "27217:27017/tcp"
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime
|
||||
- /etc/timezone:/etc/timezone
|
||||
command: mongos --bind_ip_all --configdb config/mongo_config1:27019,mongo_config2:27019,mongo_config3:27019
|
||||
depends_on:
|
||||
- mongo_config1
|
||||
- mongo_config2
|
||||
- mongo_config3
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '2.00'
|
||||
memory: 128M
|
||||
|
||||
mongo_mongos3:
|
||||
restart: always
|
||||
image: mongo:5.0.5
|
||||
container_name: mongo_mongos3
|
||||
ports:
|
||||
- "27317:27017/tcp"
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime
|
||||
- /etc/timezone:/etc/timezone
|
||||
command: mongos --bind_ip_all --configdb config/mongo_config1:27019,mongo_config2:27019,mongo_config3:27019
|
||||
depends_on:
|
||||
- mongo_config1
|
||||
- mongo_config2
|
||||
- mongo_config3
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '2.00'
|
||||
memory: 128M
|
||||
Reference in New Issue
Block a user