使用docker-compose部署MySQL三主六从半同步集群(MMM架构)_docker-compose mysql集群
以下是一个简化版的docker-compose.yml
文件示例,用于部署MySQL三主六从半同步复制集群:
version: '3'
services:
mysql-master-1:
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: root
command:
--server-id=1
--log-bin=mysql-bin
--log-slave-updates
--gtid-mode=ON
--enforce-gtid-consistency
--master-info-repository=TABLE
--relay-log-info-repository=TABLE
--binlog-format=ROW
--transaction-write-set-extraction=XXHASH64
--loose-mmm_agent_options=skip_errors=all
volumes:
- mysql-master-1-data:/var/lib/mysql
ports:
- "33061:3306"
mysql-master-2:
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: root
command:
--server-id=2
--log-bin=mysql-bin
--log-slave-updates
--gtid-mode=ON
--enforce-gtid-consistency
--master-info-repository=TABLE
--relay-log-info-repository=TABLE
--binlog-format=ROW
--transaction-write-set-extraction=XXHASH64
--loose-mmm_agent_options=skip_errors=all
volumes:
- mysql-master-2-data:/var/lib/mysql
ports:
- "33062:3306"
mysql-master-3:
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: root
command:
--server-id=3
--log-bin=mysql-bin
--log-slave-updates
--gtid-mode=ON
--enforce-gtid-consistency
--master-info-repository=TABLE
--relay-log-info-repository=TABLE
--binlog-format=ROW
--transaction-write-set-extraction=XXHASH64
--loose-mmm_agent_options=skip_errors=all
volumes:
- mysql-master-3-data:/var/lib/mysql
ports:
- "33063:3306"
mysql-slave-1:
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: root
command:
--server-id=4
--log-bin=mysql-bin
--log-slave-updates
--gtid-mode=ON
--enforce-gtid-consistency
--master-info-repository=TABLE
--relay-log-info-repository=TABLE
--binlog-format=ROW
--transaction-write-set-extraction=XXHASH64
--loose-mmm_agent_options=skip_errors=all
volumes:
- mysql-slave-1-data:/var/lib/mysql
ports:
- "33064:3306"
mysql-slave-2:
image: mysql:5.7
environmen
评论已关闭