mirror of https://github.com/easzlab/kubeasz.git
minor fix for mysql-statefulset
parent
9606ab147b
commit
f831880e05
|
@ -71,7 +71,6 @@ spec:
|
||||||
ports:
|
ports:
|
||||||
- name: mysql
|
- name: mysql
|
||||||
containerPort: 3306
|
containerPort: 3306
|
||||||
hostPort: 3306
|
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: data
|
- name: data
|
||||||
mountPath: /var/lib/mysql
|
mountPath: /var/lib/mysql
|
||||||
|
@ -107,7 +106,6 @@ spec:
|
||||||
- |
|
- |
|
||||||
set -ex
|
set -ex
|
||||||
cd /var/lib/mysql
|
cd /var/lib/mysql
|
||||||
|
|
||||||
# Determine binlog position of cloned data, if any.
|
# Determine binlog position of cloned data, if any.
|
||||||
if [[ -f xtrabackup_slave_info ]]; then
|
if [[ -f xtrabackup_slave_info ]]; then
|
||||||
# XtraBackup already generated a partial "CHANGE MASTER TO" query
|
# XtraBackup already generated a partial "CHANGE MASTER TO" query
|
||||||
|
@ -122,12 +120,10 @@ spec:
|
||||||
echo "CHANGE MASTER TO MASTER_LOG_FILE='${BASH_REMATCH[1]}',\
|
echo "CHANGE MASTER TO MASTER_LOG_FILE='${BASH_REMATCH[1]}',\
|
||||||
MASTER_LOG_POS=${BASH_REMATCH[2]}" > change_master_to.sql.in
|
MASTER_LOG_POS=${BASH_REMATCH[2]}" > change_master_to.sql.in
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if we need to complete a clone by starting replication.
|
# Check if we need to complete a clone by starting replication.
|
||||||
if [[ -f change_master_to.sql.in ]]; then
|
if [[ -f change_master_to.sql.in ]]; then
|
||||||
echo "Waiting for mysqld to be ready (accepting connections)"
|
echo "Waiting for mysqld to be ready (accepting connections)"
|
||||||
until mysql -h 127.0.0.1 -e "SELECT 1"; do sleep 1; done
|
until mysql -h 127.0.0.1 -e "SELECT 1"; do sleep 1; done
|
||||||
|
|
||||||
echo "Initializing replication from clone position"
|
echo "Initializing replication from clone position"
|
||||||
# In case of container restart, attempt this at-most-once.
|
# In case of container restart, attempt this at-most-once.
|
||||||
mv change_master_to.sql.in change_master_to.sql.orig
|
mv change_master_to.sql.in change_master_to.sql.orig
|
||||||
|
@ -140,7 +136,6 @@ spec:
|
||||||
START SLAVE;
|
START SLAVE;
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start a server to send backups when requested by peers.
|
# Start a server to send backups when requested by peers.
|
||||||
exec ncat --listen --keep-open --send-only --max-conns=1 3307 -c \
|
exec ncat --listen --keep-open --send-only --max-conns=1 3307 -c \
|
||||||
"xtrabackup --backup --slave-info --stream=xbstream --host=127.0.0.1 --user=root"
|
"xtrabackup --backup --slave-info --stream=xbstream --host=127.0.0.1 --user=root"
|
||||||
|
|
Loading…
Reference in New Issue