91 lines
2.3 KiB
YAML
91 lines
2.3 KiB
YAML
version: "3.7"
|
|
|
|
services:
|
|
mysql1:
|
|
image: harbor.colben.cn/general/mysql:8
|
|
container_name: mysql1
|
|
restart: "no"
|
|
stop_grace_period: 5m
|
|
environment:
|
|
GROUP_REPLICATION: 1
|
|
SERVER_ID: 11
|
|
GROUP_REPLICATION_LOCAL_ADDRESS: "192.168.111.11:3306"
|
|
GROUP_REPLICATION_GROUP_SEEDS: "192.168.111.11:3306,192.168.111.22:3306,192.168.111.33:3306"
|
|
networks:
|
|
mysql_replication:
|
|
ipv4_address: 192.168.111.11
|
|
volumes:
|
|
- type: bind
|
|
source: ./mysql1/my.cnf
|
|
target: /etc/my.cnf
|
|
- type: bind
|
|
source: ./mysql1/db
|
|
target: /var/lib/mysql
|
|
- type: bind
|
|
source: ./mysql1/binlog
|
|
target: /var/lib/mysql-bin
|
|
- type: bind
|
|
source: ./mysql1/log
|
|
target: /var/log/mysql
|
|
|
|
mysql2:
|
|
image: harbor.colben.cn/general/mysql:8
|
|
container_name: mysql2
|
|
restart: "no"
|
|
stop_grace_period: 5m
|
|
environment:
|
|
GROUP_REPLICATION: 1
|
|
SERVER_ID: 22
|
|
GROUP_REPLICATION_LOCAL_ADDRESS: "192.168.111.22:3306"
|
|
GROUP_REPLICATION_GROUP_SEEDS: "192.168.111.11:3306,192.168.111.22:3306,192.168.111.33:3306"
|
|
networks:
|
|
mysql_replication:
|
|
ipv4_address: 192.168.111.22
|
|
volumes:
|
|
- type: bind
|
|
source: ./mysql2/my.cnf
|
|
target: /etc/my.cnf
|
|
- type: bind
|
|
source: ./mysql2/db
|
|
target: /var/lib/mysql
|
|
- type: bind
|
|
source: ./mysql2/binlog
|
|
target: /var/lib/mysql-bin
|
|
- type: bind
|
|
source: ./mysql2/log
|
|
target: /var/log/mysql
|
|
|
|
mysql3:
|
|
image: harbor.colben.cn/general/mysql:8
|
|
container_name: mysql3
|
|
restart: "no"
|
|
stop_grace_period: 5m
|
|
environment:
|
|
GROUP_REPLICATION: 1
|
|
SERVER_ID: 33
|
|
GROUP_REPLICATION_LOCAL_ADDRESS: "192.168.111.33:3306"
|
|
GROUP_REPLICATION_GROUP_SEEDS: "192.168.111.11:3306,192.168.111.22:3306,192.168.111.33:3306"
|
|
networks:
|
|
mysql_replication:
|
|
ipv4_address: 192.168.111.33
|
|
volumes:
|
|
- type: bind
|
|
source: ./mysql3/my.cnf
|
|
target: /etc/my.cnf
|
|
- type: bind
|
|
source: ./mysql3/db
|
|
target: /var/lib/mysql
|
|
- type: bind
|
|
source: ./mysql3/binlog
|
|
target: /var/lib/mysql-bin
|
|
- type: bind
|
|
source: ./mysql3/log
|
|
target: /var/log/mysql
|
|
|
|
networks:
|
|
mysql_replication:
|
|
ipam:
|
|
config:
|
|
- subnet: "192.168.111.0/24"
|
|
|