Hy!
It was hard, but solved the script problem. I had to create the credential file in another way, so I share my experience. The basic script that I use, yo can find in this github link:
Pre-freeze:
https://github.com/VeeamHub/application ... dumppre.sh
Post-thaw:
https://github.com/VeeamHub/application ... umppost.sh
I didn't find any information about the file which has contain the credential that can access the mysql databases. This whitepaper has some tip:
https://www.veeam.com/wp-consistent-pro ... riadb.html
You can find that use a file in /etc/my.cnf which contain the following data:
Code: Select all
[client]
user = user
password = Password
port = 3306
socket = /var/lib/mysql/mysql.sock
So, it is not work for me! I searched a lot on the internet (I am not Linux guru), and find an another solution. Created a new file int /etc/mysql/mysqlpass.cnf file which contain only the following data:
Code: Select all
[mysqldump]
user=admin
password=password
I modified the credential file path to /etc/mysql/mysqlpass.cnf:
Code: Select all
#!/bin/bash
# config:
# when running on debian we can use existing debian-sys-maint account using defaults file
# otherwise, specify username and password below using use_credentials
#use_credentials="-uroot -p"
defaults_file="/etc/mysql/mysqlpass.cnf"
dump_file="/tmp/mysql_dump.sql"
database="--all-databases"
sleep 10
if [ -f $defaults_file ]
then
opts="--defaults-file=$defaults_file"
elif [ -n $use_credentials ]
then
opts="$opts $use_credentials"
else
echo "$0 : error, no mysql authentication method set" | logger
exit 1
fi
opts="$opts $database"
echo "$0 executing mysqldump" | logger
mysqldump $opts >$dump_file 2>/dev/null
if [ $? -ne 0 ]
then
echo "$0 : mysqldump failed" | logger
exit 2
else
echo "$0 : mysqldump suceeded" | logger
sync;sync
fi
You don't have to modify nothing in post-thaw script:
Code: Select all
#!/bin/bash
dump_file="/tmp/mysql_dump.sql"
if [ -f $dump_file ]
then
echo "$0 deleting mysql dump file $dump_file" | logger
rm -f $dump_file > /dev/null 2>&1
exit 0
else
echo "$0 could not locate mysql dump file $dump_file" | logger
exit 1
fi
Successfully run the backup job:
https://ibb.co/PCRkcb4
You can check, during the pr-freeze script running, the mysql_dump.sql file size is growing in /tmp folder (so the mysqldump works):
https://ibb.co/F0TcjM5
When the post-thaw script ran, the mysql_dump.sql will be removed.
Also you can check in the Linux guest OS log file: /var/log/syslog
Code: Select all
Oct 28 15:54:28 server srvadmin: /tmp/ef4ecd30-3a73-4106-8285-783aea5cb4a3_pre-freeze_hot_online_no_credetial.sh executing mysqldump
Oct 28 15:56:06 server srvadmin: /tmp/ef4ecd30-3a73-4106-8285-783aea5cb4a3_pre-freeze_hot_online_no_credetial.sh : mysqldump suceeded
Oct 28 15:56:14 serversrvadmin: /tmp/cb202cf9-bac5-4257-9680-adcd88a343be_post-thaw_hot_online.sh deleting mysql dump file /tmp/mysql_dump.sql
I hope I helped with this solution.
Thanks.