[Incubator/mysqlha] rechedule fails with persistent disks (#5523)

* STOP SLAVE IO_THREAD before changing master in xtrabackup container

* Remove slave existing data before cloning

* incremented chart version

* fix typo
This commit is contained in:
Marco Giacomassi
2018-05-17 12:12:49 -07:00
committed by k8s-ci-robot
parent b552477505
commit 9c3244f87e
2 changed files with 6 additions and 3 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
name: mysqlha
version: 0.2.0
version: 0.2.1
appVersion: 5.7.13
description: MySQL cluster with a single master and zero or more slave replicas
keywords:
+5 -2
View File
@@ -23,12 +23,14 @@ spec:
- "-c"
- |
set -ex
# Skip the clone if data already exists.
[[ -d /var/lib/mysql/mysql ]] && exit 0
# Skip the clone on master (ordinal index 0).
[[ `hostname` =~ -([0-9]+)$ ]] || exit 1
ordinal=${BASH_REMATCH[1]}
[[ $ordinal -eq 0 ]] && exit 0
# If data already exists, delete and proceed to clone.
[[ -d /var/lib/mysql/mysql ]] && rm -fr /var/lib/mysql/*
# Clone data from previous peer.
ncat --recv-only {{ template "fullname" . }}-$(($ordinal-1)).{{ template "fullname" . }} 3307 | xbstream -x -C /var/lib/mysql
# Prepare the backup.
@@ -191,6 +193,7 @@ spec:
# In case of container restart, attempt this at-most-once.
cp change_master_to.sql.in change_master_to.sql.orig
mysql -h 127.0.0.1 --verbose<<EOF
STOP SLAVE IO_THREAD;
$(<change_master_to.sql.orig),
MASTER_HOST='{{ template "fullname" . }}-0.{{ template "fullname" . }}',
MASTER_USER='${MYSQL_REPLICATION_USER}',