forked from cn7seven/bitnami-docker-mysql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose-replication.yml
48 lines (45 loc) · 1.29 KB
/
docker-compose-replication.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
version: '2.1'
services:
mysql-master:
image: 'docker.io/bitnami/mysql:8.0-debian-10'
ports:
- '3306'
volumes:
- 'mysql_master_data:/bitnami/mysql/data'
environment:
- MYSQL_REPLICATION_MODE=master
- MYSQL_REPLICATION_USER=repl_user
- MYSQL_USER=my_user
- MYSQL_DATABASE=my_database
# ALLOW_EMPTY_PASSWORD is recommended only for development.
- ALLOW_EMPTY_PASSWORD=yes
- MYSQL_ROOT_PASSWORD=my_root_password
healthcheck:
test: ['CMD', '/opt/bitnami/scripts/mysql/healthcheck.sh']
interval: 15s
timeout: 5s
retries: 6
mysql-slave:
image: 'docker.io/bitnami/mysql:8.0-debian-10'
ports:
- '3306'
depends_on:
- mysql-master
environment:
- MYSQL_REPLICATION_MODE=slave
- MYSQL_REPLICATION_USER=repl_user
- MYSQL_USER=my_user
- MYSQL_DATABASE=my_database
- MYSQL_MASTER_HOST=mysql-master
- MYSQL_MASTER_PORT_NUMBER=3306
- MYSQL_MASTER_ROOT_PASSWORD=my_root_password
# ALLOW_EMPTY_PASSWORD is recommended only for development.
- ALLOW_EMPTY_PASSWORD=yes
healthcheck:
test: ['CMD', '/opt/bitnami/scripts/mysql/healthcheck.sh']
interval: 15s
timeout: 5s
retries: 6
volumes:
mysql_master_data:
driver: local