Data(base) persistence in docker swarm mode

For setting up a multi-master, multi-source MariaDB cluster, I used container labels combined with service constraints. II used the local-persist-volume-plugin to let the config files and database itself reside on the physical node.

I initially wanted to create one service for all mariadb instances, but that was too complicated. I would need to set it up with three replicas, but if one of the three nodes went down, I would be left with one node with two replicas running on the same volume.

In the end I found it better to create three services, one for each MariaDB instance, and add the MaxScale MySQL proxy into the mix, create one service for that one, and let the proxy handle the fail over to the three mysql services. Docker can move the proxy around if it fails, or I can even create multiple instances of it.