MariaDB 10.3 dockerized with replication. Master/Slave setup in 30 seconds.
@TODO
Example docker-compose.yml for mariadb replication:
version: '3'
services:
db-master:
image: caffeina/mariadb-replication
restart: always
volumes:
- db-master-data:/var/lib/mysql:rw
environment:
MYSQL_DATABASE: "example"
MYSQL_ROOT_PASSWORD: "mastersecret"
db-slave:
image: caffeina/mariadb-replication
restart: always
depends_on:
- db-master
volumes:
- db-slave-data:/var/lib/mysql:rw
environment:
MYSQL_DATABASE: "example"
MYSQL_ROOT_PASSWORD: "slavesecret"
MYSQL_MASTER_HOST: "db-master"
MYSQL_MASTER_PASSWORD: "mastersecret"
volumes:
db-master-data:
db-slave-data:
@TODO
$ docker-compose up
@TODO
$ docker-compose -f docker-compose.yml -f docker-compose.dev.yml up --build
The mariadb-replication
image is an extension of mariadb:10.3
, you can use all the feature included in the original docker image. For more information look at mariadb documentation on docker hub.
@TODO Sets the connection parameters to the master. The MYSQL_MASTER_HOST
variable is required.
MYSQL_MASTER_HOST: "db-master"
MYSQL_MASTER_PORT: 3306 # (Optional) Default: 3306
MYSQL_MASTER_USER: "root" # (Optional) Default: 'root'
MYSQL_MASTER_PASSWORD: "secret" # (Optional) Default: ''
@TODO The generated user and password will be printed to stdout.
MYSQL_GRANT_SLAVE_USER: "user" # (Optional) Default: *RANDOM STRING*
MYSQL_GRANT_SLAVE_PASSWORD: "secret" # (Optional) Default: *RANDOM STRING*
@TODO
SERVER_ID: 2 # (Optional) Default: *RANDOM INT*
@TODO
EXPIRE_LOGS_DAYS: 5 # (Optional) Default: '10'
@TODO
MAX_BINLOG_SIZE: "50M" # (Optional) Default: '100M'
Set slave-skip-errors
option in mysql config file. Look at mysql documentation for more details.
MYSQL_SLAVE_SKIP_ERRORS: "all" # (Optional) Default: 'OFF'
- Improve documentation;
- Add
innodb-read-only
parameter (Service restart on first run is needed); - Move
/etc/mysql/conf.d/master-slave.cnf
in other path (So the user can bind a volume to/etc/mysql/conf.d/
for custom configuration); - Permit replication on existing database.
How to get involved:
- Star the project!
- Answer questions that come through GitHub issues
- Report a bug that you find
This project follows the GitFlow branching model. The master
branch always reflects a production-ready state while the latest development is taking place in the develop
branch.
Each time you want to work on a fix or a new feature, create a new branch based on the develop
branch: git checkout -b BRANCH_NAME develop
. Only pull requests to the develop
branch will be merged.
Pull requests are highly appreciated.
Solve a problem. Features are great, but even better is cleaning-up and fixing issues in the code that you discover.
This project is maintained by using the Semantic Versioning Specification (SemVer).
Copyright 2017 Caffeina srl under the MIT license.