âť—For better reliability we release images with stability tags (wodby/mariadb:11-X.X.X
) which correspond
to git tags. We strongly recommend using images only with stability tags.
Overview:
- All images based on Alpine Linux
- Base image: wodby/alpine
- GitHub actions builds
- Docker Hub
Supported tags and respective Dockerfile
links:
11.4
,11
,latest
(Dockerfile)10.11
,10
(Dockerfile)10.6
(Dockerfile)10.5
(Dockerfile)
Credits to Alpine Linux team for patches for better musl compatibility of MariaDB. Patches taken from Alpine's packages repository.
All images built for linux/amd64
and linux/arm64
.
"-" - Not available for this version
Default value for all versions:
ibdata1:10M:autoextend:max:10G"
In-depth documentation about Galera would be too lengthy for this README file. Instead, refer to these authoritative documentation sources:
When these sources disagree (for example, wsrep
options/system vars are slightly different), favor MariaDB's
documentation over Codership's.
You must set the WSREP_ON
environment variable if you want the container's /etc/mysql/my.cnf
to include
Galera/wsrep specific configuration settings.
When starting a new cluster, the first node must bootstrap the cluster:
$ docker run -e WSREP_ON=ON -v data1:/var/lib/mysql --name galera-1 \
wodby/mariadb:galera --wsrep-new-cluster
When the first node is ready, the other nodes can join it (via its hostname or IP) and participate in the cluster:
$ docker run -e WSREP_ON=ON -v data2:/var/lib/mysql --name galera-2 \
wodby/mariadb:galera --wsrep-cluster-address="gcomm://<node-1>"
$ docker run -e WSREP_ON=ON -v data3:/var/lib/mysql --name galera-3 \
wodby/mariadb:galera --wsrep-cluster-address="gcomm://<node-1>,<node-2>"
After the other nodes have joined the first, you should terminate the first container and docker run
a new container
without the --wsrep-new-cluster
and join the other nodes.
This is to prevent cluster re-bootstrap if the bootstrap container (or the host it's on) ever decided to restart.
You may also want to restart the second node with a --wsrep-cluster-address=gcomm://<node-1>,<node-3>
,
or if you know all three node hostnames or IPs ahead of time, you can use gcomm://<node-1>,<node-2>,<node-3>
for all
node containers.
For Galera clustering to work properly, it requires a quorum of nodes to agree on pending commits.
Although a one-node cluster is possible (it will always agree with itself), the minimum number of "voters" to achieve
quorum is 3.
A two-node cluster is possible, but you must add
a Galera Arbitrator Daemon (aka garbd
) as add a
third voter.
In general, it's a good idea to use garbd
for clusters with even numbers of nodes, to provide a tie-breaking vote in
case half of the nodes agree and the other half disagree.
The galera
-tagged images also include garbd
, which can be run instead of mariadb.
$ docker run wodby/mariadb:galera garbd --help
Usage: garbd [options] [group address]
[...]
Refer to the documentation for configuration details.
Usage:
make COMMAND [params ...]
commands:
import source=</path/to/dump.zip or http://example.com/url/to/dump.sql.gz> [db root_password host ignore="table1;table2;cache_%"]
backup filepath=</path/to/backup.sql.gz> [root_password host db]
query query [db user password host]
query-silent query [db user password host]
query-root query [db root_password host]
check-ready [root_password host max_try wait_seconds]
mysql-upgrade [root_password host]
mysql-check [root_password host db]
create-db name [charset collation]
drop-db name
create-user username password
drop-user username
grant-user-db username db
revoke-user-db username db
default params values:
user $MYSQL_USER
password $MYSQL_PASSWORD
db $MYSQL_DATABASE
root_password $MYSQL_ROOT_PASSWORD
host localhost
max_try 1
wait_seconds 1
ignore ""
Deploy MariaDB to your own server via Wodby.