This project provides a docker-compose setup to spawn two independent MariaDB clusters, each with 4 nodes in a single master & multiple slaves setup, and one additional warehouse database which replicates from both clusters using multisource replication.
It uses MariaDB MaxScale as access proxy and the Signal18 Replication Manager to handle failover.
A instance of PHPMyAdmin is included for convenience.
To launch, just run
docker-compose up -d
This will spawn all MariaDB instances, MaxScale and Replication Manager, and calls a setup
script (located at setup/setup.sh
) which creates permissions, sets up initial replication
in the clusters and the warehouse and creates some database tables to use.
To stop, do
docker-compose down -v
The MaxScale container is configured to use the readwritesplit
router. It exposes cluster
A on host level at port 3306
and cluster B on port 3307
. If you want to connect with the
mysql cli from your host, be sure to use 127.0.0.1
as hostname instead of localhost
,
otherwise the cli tries to connect via a socket.
MaxScale's MaxAdmin API is exposed on localhost:6603
, but it's also possible to call
maxadmin in the container with
docker-compose exec maxscale maxadmin
The web interface of Replication Manager can be accessed at http://localhost:10001
There's a command stress/create-load.sh
to be executed on the host to write data to the two
clusters.