Last active
November 28, 2023 02:49
-
-
Save casperklein/e67702b01886d4fe0aff7a0b50a2c138 to your computer and use it in GitHub Desktop.
MariaDB replication + phpmyadmin
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
# https://github.com/MariaDB/mariadb-docker/blob/master/examples/compose-replication.yml | |
version: "3" | |
services: | |
master: | |
image: mariadb:latest | |
command: --log-bin --log-basename=mariadb | |
environment: | |
- MARIADB_ROOT_PASSWORD=password | |
- MARIADB_USER=testuser | |
- MARIADB_PASSWORD=password | |
- MARIADB_DATABASE=testdb | |
- MARIADB_REPLICATION_USER=repl | |
- MARIADB_REPLICATION_PASSWORD=replicationpass | |
healthcheck: | |
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"] | |
interval: 10s | |
timeout: 5s | |
retries: 3 | |
volumes: | |
- ./mariadbdata:/var/lib/mysql | |
replica: | |
image: mariadb:latest | |
command: --server-id=2 --log-basename=mariadb | |
environment: | |
- MARIADB_ROOT_PASSWORD=password | |
- MARIADB_MASTER_HOST=master | |
- MARIADB_REPLICATION_USER=repl | |
- MARIADB_REPLICATION_PASSWORD=replicationpass | |
- MARIADB_HEALTHCHECK_GRANTS=REPLICA MONITOR | |
healthcheck: | |
test: ["CMD", "healthcheck.sh", "--connect", "--replication_io", "--replication_sql", "--replication_seconds_behind_master=1", "--replication"] | |
interval: 10s | |
timeout: 5s | |
retries: 3 | |
depends_on: | |
master: | |
condition: service_healthy | |
phpmyadmin: | |
image: phpmyadmin | |
restart: always | |
ports: | |
- 8080:80 | |
# https://github.com/phpmyadmin/docker#environment-variables-summary | |
environment: | |
- PMA_ARBITRARY=1 | |
- PMA_HOSTS=master,replica | |
- PMA_USER=root | |
- PMA_PASSWORD=password |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment