keepalived-db-cluster
Docker container running Keepalived and MariaDB Galera cluster state monitoring.
4.9K
A lightweight, Alpine-based Docker container for running Keepalived with VRRP (Virtual Router Redundancy Protocol) support and MariaDB Galera cluster state monitoring.
š” This container is a slightly modified version of peterweissdk/keepalivedā , with an added check script for monitoring the state of a MariaDB Galera cluster. It is designed to be used in conjunction with peterweissdk/galera-composeā , which sets up and runs a MariaDB Galera cluster.
Run the container:
# Pull the image
docker pull ghcr.io/peterweissdk/keepalived-db-cluster:latest
# Run with custom configuration
docker run -d \
--name keepalived \
--restart=unless-stopped \
--cap-add=NET_ADMIN \
--cap-add=NET_BROADCAST \
--cap-add=NET_RAW \
--net=host \
--env-file .env \
keepalived-db-cluster:latest
# Run the container using the provided Docker Compose and .env file
docker compose up -d
| Variable | Description | Example |
|---|---|---|
TZ | Container timezone | Europe/Copenhagen |
VRRP_INSTANCE | VRRP instance name | VI_1 |
INTERFACE | Network interface | eth0 |
STATE | Node state (MASTER/BACKUP) | MASTER |
PRIORITY | Node priority (1-255) | 100 |
ROUTER_ID | Unique router ID | 52 |
VIRTUAL_IPS | Virtual IP address with subnet mask | 192.168.1.100/24 |
UNICAST_SRC_IP | Source IP for unicast communication | 192.168.1.101 |
UNICAST_PEERS | Peer IP addresses for unicast communication | 192.168.1.102 |
WEIGHT | Weight for tracked scripts | 50 |
FALL | Number of failures before transition | 2 |
RISE | Number of successes before transition | 2 |
Create a script to run at regular intervals to check the state of your service. Create a bind mount and copy the script into it
# Clone the repository
git clone https://github.com/peterweissdk/keepalived-db-cluster.git
cd keepalived-db-cluster
# Build the image
docker build -t keepalived-db-cluster:latest .
keepalived-db-cluster/
āāā check-script
ā āāā check-script.sh
āāā conf/
ā āāā keepalived.conf_tpl
āāā scripts/
ā āāā check_and_run.sh
āāā .env
āāā Dockerfile
āāā docker-entrypoint.sh
āāā healthcheck.sh
āāā docker-compose.yml
āāā LICENSE
āāā README.md
The container includes a comprehensive health check system that monitors:
Keepalived Process Status
Virtual IP environment variable
View health status:
docker inspect --format='{{.State.Health.Status}}' keepalived-db-cluster
View detailed health check history:
docker inspect --format='{{json .State.Health}}' keepalived-db-cluster | jq
Watch health status in real-time:
watch -n 5 'docker inspect --format="{{.State.Health.Status}}" keepalived-db-cluster'
Contributions are welcome! Please feel free to submit a Pull Request.
If you encounter any issues or need support, please file an issue on the GitHub repository.
This project is licensed under the GNU GENERAL PUBLIC LICENSE v3.0 - see the LICENSEā file for details.
Content type
Image
Digest
sha256:6644fd041ā¦
Size
266 Bytes
Last updated
about 1 month ago
docker pull peterweissdk/keepalived-db-cluster:sha256-411db8cb7f568484b60d6c37f73bf0a06cb380200c9cef6575f0bb8883ce1dc1.sig