add galera
This commit is contained in:
parent
757f993e08
commit
110d8effb9
19
templates/galera/0/README.md
Normal file
19
templates/galera/0/README.md
Normal file
@ -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>`
|
52
templates/galera/0/docker-compose.yml
Normal file
52
templates/galera/0/docker-compose.yml
Normal file
@ -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
|
51
templates/galera/0/rancher-compose.yml
Normal file
51
templates/galera/0/rancher-compose.yml
Normal file
@ -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
|
66
templates/galera/catalogIcon-galera.svg
Normal file
66
templates/galera/catalogIcon-galera.svg
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
<svg version="1.1"
|
||||||
|
id="svg6517" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:svg="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cc="http://creativecommons.org/ns#" inkscape:export-ydpi="100" inkscape:export-filename="C:\docs\galera\icon-template-with-white-text" inkscape:export-xdpi="100" sodipodi:docname="icon-template-with-text2-white.svg" inkscape:version="0.91 r13725"
|
||||||
|
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-437.3 353.5 44.7 44.7"
|
||||||
|
enable-background="new -437.3 353.5 44.7 44.7" xml:space="preserve">
|
||||||
|
<filter style="color-interpolation-filters:sRGB;" inkscape:label="Drop Shadow" id="filter950">
|
||||||
|
<feFlood flood-opacity="0.23999999999999999" flood-color="rgb(0,0,0)" result="flood" id="feFlood952"></feFlood>
|
||||||
|
<feComposite in2="SourceGraphic" result="composite1" in="flood" operator="in" id="feComposite954"></feComposite>
|
||||||
|
<feGaussianBlur stdDeviation="1" result="blur" in="composite1" id="feGaussianBlur956"></feGaussianBlur>
|
||||||
|
<feOffset dy="1" result="offset" dx="0" id="feOffset958"></feOffset>
|
||||||
|
<feComposite in2="offset" result="composite2" in="SourceGraphic" operator="over" id="feComposite960"></feComposite>
|
||||||
|
</filter>
|
||||||
|
<filter inkscape:label="Badge Shadow" id="filter891" inkscape:collect="always">
|
||||||
|
<feGaussianBlur stdDeviation="0.71999962" id="feGaussianBlur893" inkscape:collect="always"></feGaussianBlur>
|
||||||
|
</filter>
|
||||||
|
<sodipodi:namedview inkscape:document-units="px" inkscape:pageopacity="0.0" inkscape:pageshadow="2" showgrid="true" bordercolor="#666666" borderopacity="1.0" pagecolor="#ffffff" inkscape:cx="-21.735309" inkscape:zoom="4.0745362" showguides="true" guidetolerance="10000" showborder="true" fit-margin-left="0" fit-margin-top="0" inkscape:cy="52.69957" id="base" inkscape:snap-grids="false" inkscape:snap-bbox-midpoints="false" inkscape:bbox-paths="true" inkscape:bbox-nodes="true" inkscape:snap-to-guides="true" inkscape:snap-bbox="true" inkscape:showpageshadow="false" inkscape:guide-bbox="true" inkscape:window-maximized="1" inkscape:window-y="-4" inkscape:window-x="-4" inkscape:window-height="852" inkscape:window-width="1600" fit-margin-bottom="0" fit-margin-right="0" inkscape:current-layer="layer1" inkscape:snap-bbox-edge-midpoints="false">
|
||||||
|
<inkscape:grid type="xygrid" id="grid821"></inkscape:grid>
|
||||||
|
<sodipodi:guide orientation="1,0" position="16,48" id="guide823"></sodipodi:guide>
|
||||||
|
<sodipodi:guide orientation="0,1" position="64,80" id="guide825"></sodipodi:guide>
|
||||||
|
<sodipodi:guide orientation="1,0" position="80,40" id="guide827"></sodipodi:guide>
|
||||||
|
<sodipodi:guide orientation="0,1" position="64,16" id="guide829"></sodipodi:guide>
|
||||||
|
</sodipodi:namedview>
|
||||||
|
<g id="layer3" inkscape:label="PLACE YOUR PICTOGRAM HERE" inkscape:groupmode="layer">
|
||||||
|
<g id="g4919" transform="matrix(0.3331644,0,0,-0.3331644,-66.396534,61.166156)" filter="url(#filter950)">
|
||||||
|
<path id="path4838_2_" inkscape:connector-curvature="0" fill="#EC7703" d="M-992.3-963.5c2.5,1.6,5.9,0.8,7.4-1.8
|
||||||
|
c1.6-2.5,0.8-5.9-1.7-7.4c-2.5-1.6-5.9-0.8-7.4,1.8C-995.6-968.4-994.8-965-992.3-963.5"/>
|
||||||
|
<path id="path4840_2_" inkscape:connector-curvature="0" fill="#EC7703" d="M-1005.6-983.5c2.5,1.6,5.9,0.8,7.4-1.8
|
||||||
|
c1.6-2.5,0.8-5.9-1.8-7.4c-2.5-1.6-5.9-0.8-7.4,1.8C-1008.9-988.4-1008.2-985-1005.6-983.5"/>
|
||||||
|
<path id="path4842_2_" inkscape:connector-curvature="0" fill="#EC7703" d="M-1025.6-996.8c2.5,1.6,5.9,0.8,7.4-1.8
|
||||||
|
c1.6-2.5,0.8-5.9-1.7-7.4c-2.5-1.6-5.9-0.8-7.4,1.8C-1028.9-1001.7-1028.1-998.4-1025.6-996.8"/>
|
||||||
|
<path id="path4844_2_" inkscape:connector-curvature="0" fill="#EC7703" d="M-987.6-939.8c2.5,1.6,5.9,0.8,7.4-1.8
|
||||||
|
c1.6-2.5,0.8-5.9-1.7-7.4c-2.5-1.6-5.9-0.8-7.4,1.8C-990.9-944.8-990.1-941.4-987.6-939.8"/>
|
||||||
|
<path id="path4846_2_" inkscape:connector-curvature="0" fill="#EC7703" d="M-992.2-916.3c2.5,1.6,5.9,0.8,7.4-1.8
|
||||||
|
c1.6-2.5,0.8-5.9-1.8-7.4c-2.5-1.6-5.9-0.8-7.4,1.8C-995.6-921.2-994.8-917.8-992.2-916.3"/>
|
||||||
|
<path id="path4848_2_" inkscape:connector-curvature="0" fill="#EC7703" d="M-1007.8-902.8c-1,2.8,0.4,5.9,3.2,7
|
||||||
|
c2.8,1.1,5.9-0.4,7-3.2c1.1-2.8-0.4-5.9-3.2-7C-1003.6-907-1006.7-905.6-1007.8-902.8"/>
|
||||||
|
<path id="path4850_2_" inkscape:connector-curvature="0" fill="#EC7703" d="M-1027.8-889.4c-1,2.8,0.4,5.9,3.2,7
|
||||||
|
c2.8,1,5.9-0.4,7-3.2c1.1-2.8-0.4-5.9-3.2-7C-1023.7-893.6-1026.8-892.2-1027.8-889.4"/>
|
||||||
|
<path id="path4852_2_" inkscape:connector-curvature="0" fill="#EC7703" d="M-1037.1-944.2l-9.4-9.7h28.7
|
||||||
|
c-0.5-13.9-14.7-25.3-27.9-25.3c-18.4,0-33.1,17-33.1,34.8c0,19.1,14.9,34.6,34.1,34.6c10.4,0,20.7-5.5,26.8-13.9l0,0l0.2-0.3
|
||||||
|
l6.7,7l0.5,0.5c-8.4,10.5-21.5,16.5-34.7,16.5c-24.5,0-44.2-20.1-44.2-44.7c0-23.6,19.2-44.2,43.1-44.2c23.9,0,40.4,18,40.4,41.4
|
||||||
|
v3.4H-1037.1"/>
|
||||||
|
<path id="path4854_2_" inkscape:connector-curvature="0" fill="#EC7703" d="M-1046.4-1000.7c-31,0-56.2,25.2-56.2,56.2
|
||||||
|
c0,31,25.2,56.2,56.2,56.2v10.8c-37,0-67-30-67-67c0-37,30-67,67-67V-1000.7"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<g id="layer2" inkscape:label="BADGE" inkscape:groupmode="layer" display="none">
|
||||||
|
<g id="g4394" transform="translate(-340.00001,-581)" display="inline">
|
||||||
|
<g id="g855">
|
||||||
|
<g id="g870" inkscape:groupmode="maskhelper" opacity="0.6" filter="url(#filter891)">
|
||||||
|
<circle id="path844_1_" cx="-115" cy="928" r="18"/>
|
||||||
|
</g>
|
||||||
|
<g id="g862">
|
||||||
|
<circle id="path4398" fill="#F5F5F5" cx="-115" cy="927" r="18"/>
|
||||||
|
<circle id="path4400" fill="#DD4814" cx="-115" cy="927" r="15"/>
|
||||||
|
|
||||||
|
<path id="path4459" sodipodi:cx="666.19574" sodipodi:arg1="1.0471976" sodipodi:arg2="1.6755161" sodipodi:r2="4.3458705" sodipodi:r1="7.2431178" sodipodi:cy="589.50385" sodipodi:sides="5" sodipodi:type="star" inkscape:randomized="0" inkscape:rounded="0.1" inkscape:flatsided="false" fill="#F5F5F5" d="
|
||||||
|
M-108.5,935.9c-0.6,0.4-5.8-2.3-6.5-2.3c-0.7,0-5.9,2.7-6.5,2.3s0.4-6.2,0.2-6.9c-0.2-0.7-4.4-4.8-4.2-5.4c0.2-0.7,6-1.6,6.6-2
|
||||||
|
c0.6-0.4,3.2-5.7,3.9-5.7c0.7,0,3.3,5.3,3.9,5.7c0.6,0.4,6.4,1.3,6.6,1.9c0.2,0.7-4,4.8-4.2,5.5
|
||||||
|
C-108.9,929.7-107.9,935.5-108.5,935.9z"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 6.2 KiB |
5
templates/galera/config.yml
Normal file
5
templates/galera/config.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
name: MariaDB Galera Cluster
|
||||||
|
description: |
|
||||||
|
(Experimental) Synchronous multi-master cluster for MariaDB
|
||||||
|
version: 10.0.22-rancher1
|
||||||
|
category: Database
|
Loading…
x
Reference in New Issue
Block a user