From efbfd7912b5fff41a3d3060af9e64c35c7e89f3b Mon Sep 17 00:00:00 2001 From: Sam Yaple Date: Thu, 25 Jun 2015 14:33:28 +0000 Subject: Ansible Mariadb w/ Galera support Adds initial support for Mariadb with Galera replication in Ansible using the CONFIG_EXTERNAL methods. Additionally, this refactors some of the Galera config script to allow for reuse by CONFIG_EXTERNAL. Partially Implements: blueprint ansible-service Change-Id: I566fea0376ecca39fc8a5167f9ff9ff434ea7b7e --- docker/common/galera/start.sh | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'docker/common/galera/start.sh') diff --git a/docker/common/galera/start.sh b/docker/common/galera/start.sh index 2ac683f11..42bd882b1 100755 --- a/docker/common/galera/start.sh +++ b/docker/common/galera/start.sh @@ -1,15 +1,25 @@ #!/bin/bash -. /opt/kolla/kolla-common.sh -. /opt/kolla/config-galera.sh +set -o errexit -check_required_vars DB_CLUSTER_INIT_DB -prepare_db +CMD="/usr/bin/mysqld_safe" +ARGS="" -if [[ "${DB_CLUSTER_INIT_DB}" == "true" ]] && ! [[ -a /var/lib/mysql/cluster.exists ]]; then - DB_CLUSTER_IS_MASTER_NODE="--wsrep-new-cluster" +# loading common functions +source /opt/kolla/kolla-common.sh + +# config-internal script exec out of this function, it does not return here +set_configs + +# loading functions +source /opt/kolla/config/config-galera.sh + +# This catches all cases of the BOOTSTRAP variable being set, including empty +if [[ "${!KOLLA_BOOTSTRAP[@]}" ]] && [[ ! -e /var/lib/mysql/cluster.exists ]]; then + ARGS="--wsrep-new-cluster" touch /var/lib/mysql/cluster.exists + populate_db + bootstrap_db fi -mysqld_safe --init-file=$DB_CLUSTER_INIT_SQL $DB_CLUSTER_IS_MASTER_NODE - +exec $CMD $ARGS -- cgit v1.2.3