Fix mariadb backup script
Change-Id: I6032bfe9504a429bdcc3cfcc6d66098e749ef726 Signed-off-by: Sergiy Markin <smarkin@mirantis.com>
This commit is contained in:
@@ -35,11 +35,11 @@ dump_databases_to_directory() {
|
||||
SCOPE=${3:-"all"}
|
||||
|
||||
|
||||
MYSQL="mysql \
|
||||
MYSQL="mariadb \
|
||||
--defaults-file=/etc/mysql/admin_user.cnf \
|
||||
--connect-timeout 10"
|
||||
|
||||
MYSQLDUMP="mysqldump \
|
||||
MYSQLDUMP="mariadb-dump \
|
||||
--defaults-file=/etc/mysql/admin_user.cnf"
|
||||
|
||||
if [[ "${SCOPE}" == "all" ]]; then
|
||||
@@ -441,11 +441,11 @@ verify_databases_backup_archives() {
|
||||
export ARCHIVE_DIR=${MARIADB_BACKUP_BASE_DIR}/db/${MARIADB_POD_NAMESPACE}/${DB_NAME}/archive
|
||||
export BAD_ARCHIVE_DIR=${ARCHIVE_DIR}/quarantine
|
||||
export MYSQL_OPTS="--silent --skip-column-names"
|
||||
export MYSQL_LIVE="mysql ${MYSQL_OPTS}"
|
||||
export MYSQL_LIVE="mariadb ${MYSQL_OPTS}"
|
||||
export MYSQL_LOCAL_OPTS=""
|
||||
export MYSQL_LOCAL_SHORT="mysql ${MYSQL_LOCAL_OPTS} --connect-timeout 2"
|
||||
export MYSQL_LOCAL_SHORT="mariadb ${MYSQL_LOCAL_OPTS} --connect-timeout 2"
|
||||
export MYSQL_LOCAL_SHORT_SILENT="${MYSQL_LOCAL_SHORT} ${MYSQL_OPTS}"
|
||||
export MYSQL_LOCAL="mysql ${MYSQL_LOCAL_OPTS} --connect-timeout 10"
|
||||
export MYSQL_LOCAL="mariadb ${MYSQL_LOCAL_OPTS} --connect-timeout 10"
|
||||
|
||||
max_wait={{ .Values.conf.mariadb_server.setup_wait.iteration }}
|
||||
duration={{ .Values.conf.mariadb_server.setup_wait.duration }}
|
||||
@@ -513,7 +513,7 @@ verify_databases_backup_archives() {
|
||||
# Before insert the tuple mentioned above, we should make sure that the MariaDB version is 10.4.+
|
||||
mariadb_version=$($MYSQL_LOCAL_SHORT -e "status" | grep -E '^Server\s+version:')
|
||||
log "Current database ${mariadb_version}"
|
||||
if [[ ! -z ${mariadb_version} && -z $(grep '10.2' <<< ${mariadb_version}}) ]]; then
|
||||
if [[ ! -z ${mariadb_version} && -z $(grep '10.2' <<< ${mariadb_version}) ]]; then
|
||||
if [[ -z $(grep 'mariadb.sys' <<< $($MYSQL_LOCAL_SHORT mysql -e "select * from global_priv where user='mariadb.sys'")) ]]; then
|
||||
$MYSQL_LOCAL_SHORT -e "insert into mysql.global_priv values ('localhost','mariadb.sys',\
|
||||
'{\"access\":0,\"plugin\":\"mysql_native_password\",\"authentication_string\":\"\",\"account_locked\":true,\"password_last_changed\":0}');"
|
||||
|
||||
8
mariadb-backup/templates/bin/_restore_mariadb.sh.tpl
Executable file → Normal file
8
mariadb-backup/templates/bin/_restore_mariadb.sh.tpl
Executable file → Normal file
@@ -35,17 +35,17 @@ RESTORE_LOG='/tmp/restore_error.log'
|
||||
rm -f $RESTORE_LOG
|
||||
|
||||
# This is for commands which require admin access
|
||||
MYSQL="mysql \
|
||||
MYSQL="mariadb \
|
||||
--defaults-file=/etc/mysql/admin_user.cnf \
|
||||
--host=$MARIADB_SERVER_SERVICE_HOST \
|
||||
--connect-timeout 10"
|
||||
|
||||
# This is for commands which we want the temporary "restore" user
|
||||
# to execute
|
||||
RESTORE_CMD="mysql \
|
||||
RESTORE_CMD="mariadb \
|
||||
--user=${RESTORE_USER} \
|
||||
--password=${RESTORE_PW} \
|
||||
--host=$MARIADB_SERVER_SERVICE_HOST \
|
||||
--host={{ tuple "oslo_db" "direct" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }} \
|
||||
--port={{ tuple "oslo_db" "direct" "mysql" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} \
|
||||
{{- if .Values.manifests.certificates }}
|
||||
--ssl-ca=/etc/mysql/certs/ca.crt \
|
||||
--ssl-key=/etc/mysql/certs/tls.key \
|
||||
|
||||
@@ -514,7 +514,7 @@ verify_databases_backup_archives() {
|
||||
mariadb_version=$($MYSQL_LOCAL_SHORT -e "status" | grep -E '^Server\s+version:')
|
||||
log "Current database ${mariadb_version}"
|
||||
if [[ ! -z ${mariadb_version} && -z $(grep '10.2' <<< ${mariadb_version}) ]]; then
|
||||
if [[ -z $(grep 'mariadb.sys' <<< $($MYSQL_LOCAL_SHORT mariadb -e "select * from global_priv where user='mariadb.sys'")) ]]; then
|
||||
if [[ -z $(grep 'mariadb.sys' <<< $($MYSQL_LOCAL_SHORT mysql -e "select * from global_priv where user='mariadb.sys'")) ]]; then
|
||||
$MYSQL_LOCAL_SHORT -e "insert into mysql.global_priv values ('localhost','mariadb.sys',\
|
||||
'{\"access\":0,\"plugin\":\"mysql_native_password\",\"authentication_string\":\"\",\"account_locked\":true,\"password_last_changed\":0}');"
|
||||
$MYSQL_LOCAL_SHORT -e 'flush privileges;'
|
||||
|
||||
@@ -37,7 +37,6 @@ rm -f $RESTORE_LOG
|
||||
# This is for commands which require admin access
|
||||
MYSQL="mariadb \
|
||||
--defaults-file=/etc/mysql/admin_user.cnf \
|
||||
--host=$MARIADB_SERVER_SERVICE_HOST \
|
||||
--connect-timeout 10"
|
||||
|
||||
# This is for commands which we want the temporary "restore" user
|
||||
@@ -45,7 +44,8 @@ MYSQL="mariadb \
|
||||
RESTORE_CMD="mariadb \
|
||||
--user=${RESTORE_USER} \
|
||||
--password=${RESTORE_PW} \
|
||||
--host=$MARIADB_SERVER_SERVICE_HOST \
|
||||
--host={{ tuple "oslo_db" "direct" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }} \
|
||||
--port={{ tuple "oslo_db" "direct" "mysql" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} \
|
||||
{{- if .Values.manifests.certificates }}
|
||||
--ssl-ca=/etc/mysql/certs/ca.crt \
|
||||
--ssl-key=/etc/mysql/certs/tls.key \
|
||||
|
||||
5
releasenotes/notes/mariadb-backup-af891fea0cfa3db5.yaml
Normal file
5
releasenotes/notes/mariadb-backup-af891fea0cfa3db5.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
mariadb:
|
||||
- |
|
||||
- fixed backup_mariadb_sh script to correctly handle verification during the backup process
|
||||
...
|
||||
5
releasenotes/notes/mariadb-dcd35d40fcd4a749.yaml
Normal file
5
releasenotes/notes/mariadb-dcd35d40fcd4a749.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
mariadb:
|
||||
- |
|
||||
- fixed backup_mariadb_sh script to correctly handle verification during the backup process
|
||||
...
|
||||
Reference in New Issue
Block a user