Skip to content

Instantly share code, notes, and snippets.

@MisterDaniels
Created November 26, 2021 18:53
Show Gist options
  • Save MisterDaniels/5191aa8167a327b99d2df3f1811541ea to your computer and use it in GitHub Desktop.
Save MisterDaniels/5191aa8167a327b99d2df3f1811541ea to your computer and use it in GitHub Desktop.
Docker banco master & slave
version: '2.1'
services:
mariadb-master:
image: docker.io/bitnami/mariadb:10.6
ports:
- '3308:3306'
volumes:
- 'mariadb_master_data:/bitnami/mariadb'
- ./mysql-dump:/docker-entrypoint-initdb.d
environment:
- MARIADB_REPLICATION_MODE=master
- MARIADB_REPLICATION_USER=replication
- MARIADB_USER=master
- ALLOW_EMPTY_PASSWORD=yes
- MARIADB_DATABASE=photobooksmall
- MARIADB_ROOT_PASSWORD=root
healthcheck:
test: ['CMD', '/opt/bitnami/scripts/mariadb/healthcheck.sh']
interval: 15s
timeout: 5s
retries: 6
networks:
- database_dev_net
mariadb-slave:
image: docker.io/bitnami/mariadb:10.6
ports:
- '3309:3306'
volumes:
- ./mysql-dump:/docker-entrypoint-initdb.d
depends_on:
- mariadb-master
environment:
- MARIADB_REPLICATION_MODE=slave
- MARIADB_REPLICATION_USER=replication
- MARIADB_USER=slave
- ALLOW_EMPTY_PASSWORD=yes
- MARIADB_DATABASE=photobooksmall
- MARIADB_MASTER_HOST=mariadb-master
- MARIADB_MASTER_PORT_NUMBER=3306
- MARIADB_MASTER_ROOT_PASSWORD=root
healthcheck:
test: ['CMD', '/opt/bitnami/scripts/mariadb/healthcheck.sh']
interval: 15s
timeout: 5s
retries: 6
networks:
- database_dev_net
volumes:
mariadb_master_data:
driver: local
networks:
database_dev_net:
driver: bridge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment