Azure VM Application Consistent MySQL DB Disk Snapshots
Backup of Database is the pillar of our system which is necessary and mandatory
to provide us data incase of crash, new machine provisioning and many other
scenarios listed here.
As
part of the backup process, a snapshot is taken, and the data is transferred to
the Recovery Services vault with no impact on production workloads. The snapshot
provides different levels of consistency, as described below:
1. Application-consistent: App-consistent backups capture memory content and pending I/O operations. App-consistent snapshots use a VSS writer (or pre/post scripts for Linux) to ensure the consistency of the app data before a backup occurs.
When you're recovering a VM with an app-consistent snapshot, the VM boots up. There's no data corruption or loss. The apps start in a consistent state.
2. File-system consistent: File-system consistent backups provide consistency by taking a snapshot of all files at the same time.
When you're recovering a VM with a file-system consistent snapshot, the VM boots up. There's no data corruption or loss. Apps need to implement their own "fix-up" mechanism to make sure that restored data is consistent.
3. Crash-consistent: Crash-consistent snapshots typically occur if an Azure VM shuts down at the time of backup. Only the data that already exists on the disk at the time of backup is captured and backed up.
Starts with the VM boot process followed by a disk check to fix corruption errors. Any in-memory data or write operations that weren't transferred to disk before the crash are lost. Apps implement their own data verification. For example, a database app can use its transaction log for verification. If the transaction log has entries that aren't in the database, the database software rolls transactions back until the data is consistent.
So now after reading snapshot consistency we should choose application consistent snapshot which doesn't let guarantees no data loss. So below are the steps for setting up application consistent snapshots for a MySQL VM.
Schedule backup on the VM using procedure listed here.
Setup pre and post backup hooks using below procedure:
Step 1: Create necessary dir and files:
mkdir -p /etc/azure/
cd /etc/azure/
mkdir logs
Step 2: create a user in Mysql with super privilege to stop and start slave.
GRANT SUPER ON *.* TO 'bkpuser'@'localhost' IDENTIFIED BY 'secretpass';
Step 3: Create below files required to configure pre and post backup hooks:
vim VMSnapshotScriptPluginConfig.json
{
"pluginName" : "ScriptRunner",
"preScriptLocation" : "/etc/azure/pre-mysql-backup.sh",
"postScriptLocation" : "/etc/azure/post-mysql-backup.sh",
"preScriptParams" : ["", ""],
"postScriptParams" : ["", ""],
"preScriptNoOfRetries" : 0,
"postScriptNoOfRetries" : 0,
"timeoutInSeconds" : 30,
"continueBackupOnFailure" : true,
"fsFreezeEnabled" : true
}
vim pre-mysql-backup.sh
#!/bin/bash
# variable declaration
PROGNAME=$(basename $0)
host=`hostname`
IP=`hostname -I | xargs`
USER="bkpuser"
PASS="secretpass"
SENDTO='recipients@company.com'
# functions
function error_exit
{
if [ $? -ne 0 ]; then
echo "${PROGNAME}: Step $1:- Failed at `($date date +"%Y_%m_%d")`" | mail -s "${PROGNAME} failed for Host : $host" -r "dba-alerts <dba-alerts@comany.com>" $SENDTO
exit 1
fi
}
touch /etc/azure/logs/$(basename $0).log
mysql -u$USER -p$PASS -e "stop slave;" 2>&1 | tee /etc/azure/logs/$(basename $0).log
error_exit "stopping slave"
vim post-mysql-backup.sh
#!/bin/bash
# variable declaration
PROGNAME=$(basename $0)
host=`hostname`
IP=`hostname -I | xargs`
USER="bkpuser"
PASS="secretpass"
SENDTO='recipients@company.com'
# functions
function error_exit
{
if [ $? -ne 0 ]; then
echo "${PROGNAME}: Step $1:- Failed at `($date date +"%Y_%m_%d")`" | mail -s "${PROGNAME} failed for Host : $host" -r "dba-alerts <dba-alerts@company.com>" $SENDTO
exit 1
fi
}
touch /etc/azure/logs/$(basename $0).log
mysql -u$USER -p$PASS -e "start slave;" 2>&1 | tee /etc/azure/logs/$(basename $0).log
error_exit "starting slave"
Step 4: Configure required permission on the files by azure backup
chmod 700 *.sh
chmod 600 VMSnapshotScriptPluginConfig.json
Ref:
Note Stopping Slave does not guaranty consistency. Innodb will continue to do work in background.
ReplyDeleteCorrect Peter! I think that is taken care by "fsFreezeEnabled" : true.
DeletePS: Please guide if we should add something else to make it consistent :)
Azure Vm Application Consistent Mysql Db Disk Snapshots >>>>> Download Now
Delete>>>>> Download Full
Azure Vm Application Consistent Mysql Db Disk Snapshots >>>>> Download LINK
>>>>> Download Now
Azure Vm Application Consistent Mysql Db Disk Snapshots >>>>> Download Full
>>>>> Download LINK dI
nice one Ankit !!
ReplyDeleteGreat Post with valuable info. Thank you for the updates.
ReplyDeleteLearn Dot NET Online
dot net certification course online
Thank you for sharing such useful information. I really enjoyed while reading your article and it is good to know the latest updates. Do post more. And also get to know about the best
ReplyDeleteMySQL Development Company
sccm online training
ReplyDeletewindows admin online training
mysql online training
event management. Doubling down on becoming the leading networking-focused hybrid event platform and They continue to build an impressive client list that includes some of the largest companies in B2B events. formal invitation email sample and speaker bio
ReplyDeleteVery useful information.Thankyou so much for this wonderful blog…Great work keep going. Looking for the best database services in Hyderabad hire Cyanous software solutions now.
ReplyDeleteBest Database services in Hyderabad
Best software & web development company in Hyderabad
nice post.office 365 online training
ReplyDeleteUKSSC assistant accountant exam
ReplyDeleteYour style is so unique compared to other people I have read stuff from. Many thanks forposting when you have the opportunity, Guess I will just bookmark this site Debut Drive SnapShot
ReplyDeleteGreat blog.thanks for sharing such a useful information
ReplyDeleteSalesforce CRM Training in Chennai
I thought this was a pretty interesting read when it comes to this topic. Thank you
ReplyDeletedrive-snapshot-crack
az-104 interview questions
ReplyDeletescrum master exam questions/
dp-900 exam questions/
Great post.
ReplyDeleteMysql DBA Course
I am very happy to read this article. Thanks for giving us Amazing info. Fantastic post.
ReplyDeleteThanks For Sharing such an informative article, Im taking your feed also, Thanks.iobit-uninstaller-pro-crack/
I was looking for this information from enough time and now I reached your website it’s really good content.
ReplyDeleteThanks for writing such a nice content for us.
2020/12/26/windows-server-2019-2016-product-key-free
It solved all my queries perfectly. Our HP Printer offline service is also offered to get your printer offline.
ReplyDeleteOur HP Printer offline service is also offered to get your printer offline.
hdoujin-downloader-crack/
Hello Dear, I love your site. Many thanks for the shared this informative and interesting post with us.
ReplyDeleteMockplus
Azure Vm Application Consistent Mysql Db Disk Snapshots >>>>> Download Now
ReplyDelete>>>>> Download Full
Azure Vm Application Consistent Mysql Db Disk Snapshots >>>>> Download LINK
>>>>> Download Now
Azure Vm Application Consistent Mysql Db Disk Snapshots >>>>> Download Full
>>>>> Download LINK su
SMM PANEL
ReplyDeletesmm panel
iş ilanları
İNSTAGRAM TAKİPÇİ SATIN AL
Https://www.hirdavatciburada.com
Www.beyazesyateknikservisi.com.tr
SERVİS
JETON HİLESİ
üsküdar toshiba klima servisi
ReplyDeletebeykoz beko klima servisi
çekmeköy alarko carrier klima servisi
ümraniye samsung klima servisi
kartal mitsubishi klima servisi
tuzla bosch klima servisi
maltepe daikin klima servisi
pendik beko klima servisi
kadıköy alarko carrier klima servisi
good remark, please keep posting
ReplyDeletegood remark software training in Hyderabad