GROUPReplicate: docker-compose.yml

File docker-compose.yml, 3.7 KB (added by krit, 2 years ago)
Line 
1version: '3.5'
2
3services:
4
5  node1:
6    image: mysql/mysql-server:8.0
7    container_name: node1
8    hostname: node1
9    ports:
10      - "3307:3306"
11    restart: unless-stopped
12    environment:
13      - MYSQL_ROOT_PASSWORD=mypass
14    command: ["mysqld",
15      "--server-id=1",
16      "--log-bin=mysql-bin-1.log",
17      "--enforce-gtid-consistency=ON",
18      "--log-slave-updates=ON",
19      "--gtid-mode=ON",
20      "--transaction-write-set-extraction=XXHASH64",
21      "--binlog-checksum=NONE",
22      "--master-info-repository=TABLE",
23      "--relay-log-info-repository=TABLE",
24      "--plugin-load=group_replication.so",
25      "--relay-log-recovery=ON",
26      "--loose-group-replication-start-on-boot=OFF",
27      "--loose-group-replication-group-name=aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
28      "--loose-group-replication-local-address=node1:6606",
29      "--loose-group-replication-group-seeds=node1:6606,node2:6606,node3:6606",
30      "--loose-group-replication-single-primary-mode=ON",
31      "--loose-group-replication-enforce-update-everywhere-checks=OFF"]
32    healthcheck:
33      test: "mysqladmin ping -u root -p$${MYSQL_ROOT_PASSWORD}"
34      interval: 2s
35      retries: 20
36    networks:
37      - mysqlgr
38    deploy:
39      placement:
40        constraints:
41        - node.role == manager
42
43  node2:
44    image: mysql/mysql-server:8.0
45    container_name: node2
46    hostname: node2
47    ports:
48      - "3308:3306"
49    restart: unless-stopped
50    environment:
51      - MYSQL_ROOT_PASSWORD=mypass
52    command: ["mysqld",
53      "--server-id=1",
54      "--log-bin=mysql-bin-1.log",
55      "--enforce-gtid-consistency=ON",
56      "--log-slave-updates=ON",
57      "--gtid-mode=ON",
58      "--transaction-write-set-extraction=XXHASH64",
59      "--binlog-checksum=NONE",
60      "--master-info-repository=TABLE",
61      "--relay-log-info-repository=TABLE",
62      "--plugin-load=group_replication.so",
63      "--relay-log-recovery=ON",
64      "--loose-group-replication-start-on-boot=OFF",
65      "--loose-group-replication-group-name=aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
66      "--loose-group-replication-local-address=node2:6606",
67      "--loose-group-replication-group-seeds=node1:6606,node2:6606,node3:6606",
68      "--loose-group-replication-single-primary-mode=ON",
69      "--loose-group-replication-enforce-update-everywhere-checks=OFF"]
70    healthcheck:
71      test: "mysqladmin ping -u root -p$${MYSQL_ROOT_PASSWORD}"
72      interval: 2s
73      retries: 20
74    networks:
75      - mysqlgr
76    deploy:
77      placement:
78        constraints:
79        - node.role == manager
80
81  node3:
82    image: mysql/mysql-server:8.0
83    container_name: node3
84    hostname: node3
85    ports:
86      - "3309:3306"
87    restart: unless-stopped
88    environment:
89      - MYSQL_ROOT_PASSWORD=mypass
90    command: ["mysqld",
91      "--server-id=1",
92      "--log-bin=mysql-bin-1.log",
93      "--enforce-gtid-consistency=ON",
94      "--log-slave-updates=ON",
95      "--gtid-mode=ON",
96      "--transaction-write-set-extraction=XXHASH64",
97      "--binlog-checksum=NONE",
98      "--master-info-repository=TABLE",
99      "--relay-log-info-repository=TABLE",
100      "--plugin-load=group_replication.so",
101      "--relay-log-recovery=ON",
102      "--loose-group-replication-start-on-boot=OFF",
103      "--loose-group-replication-group-name=aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
104      "--loose-group-replication-local-address=node3:6606",
105      "--loose-group-replication-group-seeds=node1:6606,node2:6606,node3:6606",
106      "--loose-group-replication-single-primary-mode=ON",
107      "--loose-group-replication-enforce-update-everywhere-checks=OFF"]
108    healthcheck:
109      test: "mysqladmin ping -u root -p$${MYSQL_ROOT_PASSWORD}"
110      interval: 2s
111      retries: 20
112    networks:
113      - mysqlgr
114    deploy:
115      placement:
116        constraints:
117        - node.role == manager
118
119networks:
120  mysqlgr: