root
5 years ago
7 changed files with 14 additions and 74 deletions
@ -0,0 +1,5 @@ |
|||||
|
#!/bin/bash |
||||
|
docker stack rm stack |
||||
|
lxc-stop --name worker1; lxc-stop --name worker2 |
||||
|
docker node rm worker1; docker node rm worker2 |
||||
|
rm -rf /var/lib/lxc/worker* |
@ -1,40 +0,0 @@ |
|||||
--- |
|
||||
- setup: |
|
||||
tags: galera |
|
||||
|
|
||||
- name: Copy galera template |
|
||||
template: |
|
||||
src: galera.cnf.j2 |
|
||||
dest: /opt/galera.cnf |
|
||||
owner: root |
|
||||
group: root |
|
||||
mode: '0644' |
|
||||
remote_src: no |
|
||||
tags: galera |
|
||||
|
|
||||
- name: Galera template fix |
|
||||
shell: sed -i "s/ /,/g;s/ 1/1/g;s/ "/"/g" /opt/galera.cnf |
|
||||
|
|
||||
#- name: set mysql options fact |
|
||||
# set_fact: |
|
||||
# extra_docker_options: "--wsrep-new-cluster" |
|
||||
# when: ansible_hostname == 'worker1' |
|
||||
|
|
||||
- name: Copy Dockerfile template |
|
||||
template: |
|
||||
src: Dockerfile.j2 |
|
||||
dest: /opt/Dockerfile |
|
||||
remote_src: no |
|
||||
|
|
||||
#- name: Build 'swarm-galera' image |
|
||||
# docker_image: |
|
||||
# name: 'swarm-galera' |
|
||||
# build: |
|
||||
# path: / |
|
||||
# tag: v1 |
|
||||
# source: build |
|
||||
|
|
||||
- name: Build image from Dockerfile |
|
||||
shell: docker build -t ubuntu:galera-node-{{ ansible_hostname }} . |
|
||||
args: |
|
||||
chdir: /opt |
|
@ -1,11 +0,0 @@ |
|||||
FROM ubuntu:16.04 |
|
||||
RUN apt-get update |
|
||||
RUN apt-get install -y software-properties-common wget |
|
||||
RUN wget https://mariadb.org/mariadb_release_signing_key.asc -O - | apt-key add - |
|
||||
RUN add-apt-repository "deb [arch=amd64,arm64,i386,ppc64el] http://mirrors.coreix.net/mariadb/repo/10.4/ubuntu xenial main" |
|
||||
RUN apt-get update |
|
||||
RUN apt install -y rsync mariadb-server-10.4 galera-4 mariadb-client-10.4 |
|
||||
RUN systemctl unmask mariadb |
|
||||
COPY galera.cnf /etc/mysql/conf.d/galera.cnf |
|
||||
#RUN echo "wsrep_node_address=`ip a s eth0|grep inet|head -1|awk '{print $2}'|cut -d "/" -f 1`" >> /etc/mysql/conf.d/galera.cnf |
|
||||
ENTRYPOINT ["mysqld","{{ extra_docker_options }}"] |
|
@ -1,17 +0,0 @@ |
|||||
[mysqld] |
|
||||
binlog_format=ROW |
|
||||
default-storage-engine=innodb |
|
||||
innodb_autoinc_lock_mode=2 |
|
||||
bind-address=0.0.0.0 |
|
||||
|
|
||||
# Galera Provider Configuration |
|
||||
wsrep_on=ON |
|
||||
wsrep_provider=/usr/lib/galera/libgalera_smm.so |
|
||||
|
|
||||
# Galera Cluster Configuration |
|
||||
wsrep_cluster_name="galera_cluster" |
|
||||
|
|
||||
# Galera Synchronization Configuration |
|
||||
wsrep_sst_method=rsync |
|
||||
|
|
||||
# Galera Node Configuration |
|
Loading…
Reference in new issue