-
-
Save ProMasoud/5faf9bc354b305d310d39aa9132616ce to your computer and use it in GitHub Desktop.
Mysql Replication in docker
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
DB_PORT= | |
DB_DATABASE= | |
DB_USERNAME= | |
DB_PASSWORD= |
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: '3' | |
services: | |
db: | |
image: mysql:8.0 | |
container_name: db | |
restart: always | |
ports: | |
- $DB_PORT:3306 | |
command: | |
- --default-authentication-plugin=mysql_native_password | |
volumes: | |
- ./master.conf.cnf:/etc/mysql/conf.d/mysql.conf.cnf | |
- db:/var/lib/mysql | |
environment: | |
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD} | |
MYSQL_PASSWORD: ${DB_PASSWORD} | |
MYSQL_USER: ${DB_USERNAME} | |
MYSQL_DATABASE: ${DB_DATABASE} | |
networks: | |
- internal | |
adminer: | |
image: adminer:latest | |
restart: always | |
ports: | |
- "8081:8080" | |
networks: | |
- internal | |
#Docker Networks | |
networks: | |
internal: | |
#Volumes | |
volumes: | |
db: |
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: '3' | |
services: | |
mysql_slave: | |
image: mysql:8.0 | |
environment: | |
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD} | |
MYSQL_PASSWORD: ${DB_PASSWORD} | |
MYSQL_USER: ${DB_USERNAME} | |
MYSQL_DATABASE: ${DB_DATABASE} | |
container_name: "mysql_slave" | |
restart: "always" | |
ports: | |
- $MYSQL_PORT:3306 | |
volumes: | |
- ./slave.conf.cnf:/etc/mysql/conf.d/mysql.conf.cnf | |
- data:/var/lib/mysql | |
networks: | |
- internal | |
adminer: | |
image: adminer:latest | |
restart: always | |
ports: | |
- "8080:8080" | |
networks: | |
- internal | |
#Docker Networks | |
networks: | |
internal: | |
#Volumes | |
volumes: | |
db: |
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
[mysqld] | |
server-id = 1 | |
log-bin = mysql-bin-1.log | |
binlog_format = ROW | |
binlog_do_db = bit24 | |
tmpdir = /tmp | |
max_binlog_size = 500M | |
sync_binlog = 1 | |
expire-logs-days = 3 | |
slow_query_log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment