percona xtradb cluster deployment

This commit is contained in:
Bryan Joshua Pedini 2023-09-30 15:01:04 +02:00
parent ca37171e15
commit 4fdbd25ddd
6 changed files with 52 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.env
data

8
bootstrap.sh Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
read -p "\$DATA directory: " DATA_DIRECTORY
REALDIR=$(readlink -f "${DATA_DIRECTORY}")
mkdir -p "${DATA_DIRECTORY}"
mkdir "${DATA_DIRECTORY}/conf" "${DATA_DIRECTORY}/cert" "${DATA_DIRECTORY}/mysql"
chown 1001:1001 "${DATA_DIRECTORY}/cert" "${DATA_DIRECTORY}/mysql"
docker run --rm -v "${REALDIR}"/cert:/cert percona/percona-xtradb-cluster:8.0 mysql_ssl_rsa_setup -d /cert

19
docker-compose.yml Normal file
View File

@ -0,0 +1,19 @@
---
services:
percona:
image: percona/percona-xtradb-cluster:${PERCONA_VERSION}
restart: unless-stopped
environment:
- CLUSTER_NAME=${PERCONA_CLUSTER_NAME}
- MYSQL_ROOT_PASSWORD=${PERCONA_ROOT_PASSWORD}
hostname: ${PERCONA_HOSTNAME}
ports:
- 3306:3306/tcp
- 4444:4444/tcp
- 4567:4567/tcp
- 4567:4567/udp
- 4568:4568/tcp
volumes:
- ${PERCONA_DATA}/cert:/cert
- ${PERCONA_DATA}/config:/etc/percona-xtradb-cluster.conf.d
- ${PERCONA_DATA}/mysql:/var/lib/mysql

15
example.custom.cnf Normal file
View File

@ -0,0 +1,15 @@
[mysqld]
ssl-ca = /cert/ca.pem
ssl-cert = /cert/server-cert.pem
ssl-key = /cert/server-key.pem
[client]
ssl-ca = /cert/ca.pem
ssl-cert = /cert/client-cert.pem
ssl-key = /cert/client-key.pem
[sst]
encrypt = 4
ssl-ca = /cert/ca.pem
ssl-cert = /cert/server-cert.pem
ssl-key = /cert/server-key.pem

5
example.env Normal file
View File

@ -0,0 +1,5 @@
PERCONA_VERSION=8.0
PERCONA_DATA=./data
PERCONA_HOSTNAME=pcx
PERCONA_CLUSTER_NAME=percona
PERCONA_ROOT_PASSWORD=r00t

3
example.mysqld.cnf Normal file
View File

@ -0,0 +1,3 @@
wsrep_provider=/usr/lib/galera4/libgalera_smm.so
wsrep_cluster_name=percona
wsrep_cluster_address=gcomm://192.168.10.11,192.168.10.12,192.168.10.13