Created
August 8, 2019 11:02
-
-
Save FlowerWrong/b2b0f7552bb792844e9193c92d74a7ee to your computer and use it in GitHub Desktop.
mysql-master-salve.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2' | |
services: | |
mysql-master: | |
image: 'bitnami/mysql:8.0' | |
ports: | |
- '3306: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 | |
mysql-slave: | |
image: 'bitnami/mysql:8.0' | |
ports: | |
- '3307: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 | |
volumes: | |
mysql_master_data: | |
driver: local | |
# docker-compose up --detach --scale mysql-master=1 --scale mysql-slave=3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment