Last active
May 18, 2024 12:02
-
-
Save getvictor/92ce5a8541ce27a1ea36f9eb7feb0344 to your computer and use it in GitHub Desktop.
Create MySQL DBs for master-slave replication (https://victoronsoftware.com/posts/mysql-master-slave-replication/)
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: mysql:8.0 | |
volumes: | |
- mysql-replica-main:/tmp | |
command: | |
[ | |
"mysqld", | |
"--datadir=/tmp/mysqldata-replica-main", | |
"--log-bin=bin.log", | |
"--server-id=1" | |
] | |
environment: | |
&mysql-default-environment | |
MYSQL_ROOT_PASSWORD: toor | |
MYSQL_DATABASE: test | |
MYSQL_USER: test_user | |
MYSQL_PASSWORD: insecure | |
ports: | |
- "3308:3306" | |
mysql_slave: | |
image: mysql:8.0 | |
volumes: | |
- mysql-replica-read:/tmp | |
command: | |
[ | |
"mysqld", | |
"--datadir=/tmp/mysqldata-replica-read", | |
"--log-bin=bin.log", | |
"--server-id=2" | |
] | |
environment: *mysql-default-environment | |
ports: | |
- "3309:3306" | |
volumes: | |
mysql-replica-main: | |
mysql-replica-read: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment