Discussions specific to the VMware vSphere hypervisor
Post Reply
yihwang
Influencer
Posts: 13
Liked: 1 time
Joined: Aug 23, 2017 8:57 am
Full Name: Yeongil Hwang
Contact:

MariaDB Backup using script

Post by yihwang » May 02, 2018 6:53 am

Hello.
Thank you for every time, and I'll ask for help for mariaDB Backup.

I set consistent MariaDB Backup job based on veeam white paper.
But, it was failed and there is no other log except for the message 'mysql command has failed (bad credentials?) by script intentionally in /var/log/messages.
I don't know where to find log.

Should I consider specific thins for MariaDB Backup?
And, Please let me know troubleshooting method for linux mariaDB backup.

p.s. From googling, it should be used different method between Pure InnoDB and mix of InnoDB and MYISAM.
Is it right?

The code I used is below.

Code: Select all

#!/bin/bash

use_credentials="-uroot -p"
timeout=300
lock_file=/tmp/mysql_tables_read_lock

opts="$opts $use_credentials"

sleep_time=$((timeout+10))

rm -f $lock_file
echo "$0 executing FLUSH TABLES WITH READ LOCK"| logger
mysql $opts -e "FLUSH TABLES WITH READ LOCK; system touch $lock_file; system nohup sleep $sleep_time; system echo\ lock released|logger; " > /dev/null &
mysql_pid=$!
echo "$0 child pid $mysql_pid" | logger
c=0

while [ ! -f $lock_file ]
do
# check if mysql is running
if ! ps -p $mysql_pid 1>/dev/null ; then
echo "$0 mysql command has failed (bad credentials?)" | logger
exit 1
fi
sleep 1
c=$((c+1))
if [ $c -gt $timeout ]; then
echo "$0 timeout waiting for lock" | logger
touch $lock_file
kill $mysql_pid
fi
done
echo $mysql_pid > $lock_file
exit 0

-Backup Information
Hypervisor: VMware ESXi 6.0
Tools version: 10.0.6.54238
Guest OS Version: Centos release 6.4 (Final)
Kernel version: 2.6.32-358.el6.x86_64
MariaDB Version: 10.1.18-MariaDB

Dima P.
Product Manager
Posts: 9755
Liked: 771 times
Joined: Feb 04, 2013 2:07 pm
Full Name: Dmitry Popov
Location: Prague
Contact:

Re: MariaDB Backup using script

Post by Dima P. » May 02, 2018 11:40 am

Hello yihwang,

It's not clear when you get this error. Was this script tested on the machine with MariaDB or in backup job? Thanks.

yihwang
Influencer
Posts: 13
Liked: 1 time
Joined: Aug 23, 2017 8:57 am
Full Name: Yeongil Hwang
Contact:

Re: MariaDB Backup using script

Post by yihwang » May 02, 2018 1:14 pm

I set the script in backup job.
After failed, I also tested the script on the machine that was restored from Instasnt Recovery without network connection check if the script is working.
At that time, it worked well. Next, I wanted to test it during online, but it didn't permitted.

Post Reply

Who is online

Users browsing this forum: Baidu [Spider] and 21 guests