add galera
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
# Galera Cluser (Experimental)
|
||||
|
||||
### Info:
|
||||
|
||||
This template creates a MariaDB Galera cluster on top of Rancher. Using the Galera plugin, the MariaDB cluster runs in a multi-master replicated mode.
|
||||
|
||||
When deployed from the catalog, a three node cluster is created with a database, root password, database user and password. The cluster is set up for replication between all of the nodes. The cluster sits behind a light weight proxy layer that forwards all reads/writes to a single server in order for transaction locks. The proxy layer is fronted by a Rancher load balancer.
|
||||
|
||||
Clients should access the cluster through the load balancer so they do not need to be updated in the event of a failure.
|
||||
|
||||
When the cluster is completely stopped and started, user intervention is required to bring it back online. Instructions can be found in the [Galera documentation](http://galeracluster.com/documentation-webpages/quorumreset.html).
|
||||
|
||||
The replication mechanism used in the cluster is based on the MySQL dump method. This has the side effect of taking a long time to bring in a new node when there are large data sets.
|
||||
|
||||
### Usage:
|
||||
|
||||
Once deployed, use a mysql client to connect:
|
||||
|
||||
`mysql -u<db_user> -p -h<galera-lb>`
|
||||
@@ -0,0 +1,52 @@
|
||||
mariadb-galera-server:
|
||||
image: rancher/galera:10.0.22-rancher2
|
||||
net: "container:galera"
|
||||
environment:
|
||||
TERM: "xterm"
|
||||
MYSQL_ROOT_PASSWORD: "${mysql_root_password}"
|
||||
MYSQL_DATABASE: "${mysql_database}"
|
||||
MYSQL_USER: "${mysql_user}"
|
||||
MYSQL_PASSWORD: "${mysql_password}"
|
||||
volumes_from:
|
||||
- 'mariadb-galera-data'
|
||||
labels:
|
||||
io.rancher.container.hostname_override: container_name
|
||||
entrypoint: bash -x /opt/rancher/start_galera
|
||||
mariadb-galera-data:
|
||||
image: rancher/galera:10.0.22-rancher2
|
||||
net: none
|
||||
environment:
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
|
||||
volumes:
|
||||
- /var/lib/mysql
|
||||
- /etc/mysql/conf.d
|
||||
- /docker-entrypoint-initdb.d
|
||||
- /opt/rancher
|
||||
command: /bin/true
|
||||
labels:
|
||||
io.rancher.container.start_once: true
|
||||
galera-leader-forwarder:
|
||||
image: rancher/galera-leader-proxy:v0.1.0
|
||||
net: "container:galera"
|
||||
volumes_from:
|
||||
- 'mariadb-galera-data'
|
||||
galera:
|
||||
image: rancher/galera-conf:v0.2.0
|
||||
labels:
|
||||
io.rancher.sidekicks: mariadb-galera-data,mariadb-galera-server,galera-leader-forwarder
|
||||
io.rancher.container.hostname_override: container_name
|
||||
io.rancher.scheduler.affinity:container_label_soft_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name}
|
||||
volumes_from:
|
||||
- 'mariadb-galera-data'
|
||||
stdin_open: true
|
||||
tty: true
|
||||
command: /bin/bash
|
||||
|
||||
galera-lb:
|
||||
expose:
|
||||
- 3306:3307/tcp
|
||||
tty: true
|
||||
image: rancher/load-balancer-service
|
||||
links:
|
||||
- galera:galera
|
||||
stdin_open: true
|
||||
@@ -0,0 +1,51 @@
|
||||
.catalog:
|
||||
name: "Galera DB"
|
||||
version: 10.0.22-rancher1
|
||||
description: |
|
||||
Galera Cluster based on MariaDB 10.0.22
|
||||
questions:
|
||||
- variable: "mysql_root_password"
|
||||
type: string
|
||||
required: true
|
||||
label: "MySQL Root Password"
|
||||
description: "Password given to the root mysql user"
|
||||
- variable: "mysql_database"
|
||||
type: string
|
||||
required: true
|
||||
label: "MySQL Database Name"
|
||||
description: "MySQL database to create"
|
||||
- variable: "mysql_user"
|
||||
type: string
|
||||
required: true
|
||||
description: "MySQL user for the created database"
|
||||
label: "MySQL DB User"
|
||||
- variable: "mysql_password"
|
||||
type: string
|
||||
required: true
|
||||
label: "MySQL DB Password"
|
||||
description: "Password for the MySQL user of the created database"
|
||||
galera:
|
||||
scale: 3
|
||||
metadata:
|
||||
mysqld: |
|
||||
innodb_file_per_table = 1
|
||||
innodb_autoinc_lock_mode=2
|
||||
query_cache_size=0
|
||||
query_cache_type=0
|
||||
innodb_flush_log_at_trx_commit=0
|
||||
binlog_format=ROW
|
||||
default-storage-engine=innodb
|
||||
wsrep_provider=/usr/lib/galera/libgalera_smm.so
|
||||
wsrep_provider_options="gcache.size = 2G"
|
||||
wsrep_sst_method=mysqldump
|
||||
wsrep_sst_auth=root:${mysql_root_password}
|
||||
progress=1
|
||||
galera-lb:
|
||||
scale: 1
|
||||
load_balancer_config: {}
|
||||
health_check:
|
||||
port: 42
|
||||
interval: 2000
|
||||
unhealthy_threshold: 3
|
||||
healthy_threshold: 2
|
||||
response_timeout: 2000
|
||||
Reference in New Issue
Block a user