An open API service indexing awesome lists of open source software.

https://github.com/martinrusev/mariadb-galera-docker


https://github.com/martinrusev/mariadb-galera-docker

Last synced: 2 months ago
JSON representation

Awesome Lists containing this project

README

        

# MariaDB Galera Docker Image

## Description

This is a MariaDB Galera docker image build on top of Ubuntu 21.04

## Environment Variables

### MariaDB Specific

| Environment Variable | Value | Default |
| ------------------------------- | ------ | ------- |
| ALLOW_EMPTY_PASSWORD | string | no |
| DEBUG | bool | true |
| DEBUG | bool | true |
| MARIADB_DEFAULT_PORT_NUMBER | | |
| MARIADB_DEFAULT_CHARACTER_SET | string | utf8 |
| MARIADB_DEFAULT_PORT_NUMBER | int | 3306 |
| MARIADB_DEFAULT_BIND_ADDRESS | string | 0.0.0.0 |
| MARIADB_ROOT_USER | string | root |
| MARIADB_USER | string | - |
| MARIADB_MASTER_HOST | string | - |
| MARIADB_MASTER_ROOT_PASSWORD | string | - |
| MARIADB_REPLICATION_USER | string | - |
| MARIADB_REPLICATION_PASSWORD | string | - |
| MARIADB_REPLICATION_MODE | string | - |
| MARIADB_EXTRA_FLAGS | string | - |
| MARIADB_SKIP_TEST_DB | string | no |
| MARIADB_CLIENT_ENABLE_SSL | string | no |
| MARIADB_CLIENT_SSL_CA_FILE | string | - |
| MARIADB_CLIENT_SSL_CERT_FILE | string | - |
| MARIADB_CLIENT_SSL_KEY_FILE | string | - |
| MARIADB_CLIENT_EXTRA_FLAGS | string | - |
| MARIADB_STARTUP_WAIT_RETRIES | int | 300 |
| MARIADB_STARTUP_WAIT_SLEEP_TIME | int | 2 |

### Galera

| Environment Variable | Value | Default |
| ------------------------------------------- | ------ | ----------- |
| MARIADB_GALERA_DEFAULT_CLUSTER_ADDRESS | string | gcomm:// |
| MARIADB_GALERA_DEFAULT_CLUSTER_NAME | string | galera |
| MARIADB_GALERA_DEFAULT_NODE_NAME | string | - |
| MARIADB_GALERA_DEFAULT_NODE_ADDRESS | string | - |
| MARIADB_GALERA_DEFAULT_SST_METHOD | string | mariabackup |
| MARIADB_GALERA_DEFAULT_MARIABACKUP_USER | string | mariabackup |
| MARIADB_GALERA_DEFAULT_MARIABACKUP_PASSWORD | string | - |
| MARIADB_GALERA_FORCE_SAFETOBOOTSTRAP | string | - |
| MARIADB_GALERA_CLUSTER_BOOTSTRAP | string | - |
| MARIADB_GALERA_CLUSTER_ADDRESS | string | - |
| MARIADB_GALERA_NODE_NAME | string | - |
| MARIADB_GALERA_NODE_ADDRESS | string | - |

### Running the image

### Requirements

```
docker 20.10+
```

To run this image, we have to do the following:

```
docker build -t mariadb-galera:latest .
docker-compose up
```

At this time only connections from localhost are allowed.
To connect to the container from another host/network, we have to do the following:

```
docker exec -it mariadb-galera-docker_mariadb-galera_1 /bin/bash

mysql --user root --socket /opt/canonical/mariadb-galera/mariadb/tmp/mysql.sock

CREATE USER 'root'@'%';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
```

### Using the image in a Microk8s cluster

```
$ microk8s enable registry
$ docker images

-> Find the tag for the mariadb-galera image, built in the previous step

$ docker tag {image_id} localhost:32000/mariadb-galera:latest
$ docker push localhost:32000/mariadb-galera:latest
```

Useful commands, when using the MicroK8S local registry:

- Get the list of images pushed to the registry

http://localhost:32000/v2/_catalog?n=10

- Get a list of versions for the mariadb galera image

http://localhost:32000/v2/mariadb-galera/tags/list?n=10