I've already reviewed the procedure for backing up MySQL on Linux. However I'm trying to backup MySQL on Windows inside Hyper-V. I have a Powershell script to stop the MySQL Service, but it doesn't appear to be working:
# Get the MySQL Service
# This is specifically named after the instance I think, so it could be different per server
$Service = Get-Service MySQL*
# If the Service is Running, Stop the service.
do {Stop-Service $Service -Force -PassThru; sleep 30; $ct = $ct + 1} while (($Service.Status -ne "Stopped") -and ($ct -lt 4))
The script is stored on the Veeam Backup Server, it is not signed. Any suggestions or other ways to go about this?
Your pre-job script is trying perform all actions specified on your Veeam Backup Server, i.e. it tries to stop MySQL service on you VBR not on Windows guest. You need to you edit the script so that it connects to the remote MySQL server and stops it.
# Get the MySQL Service
# This is specifically named after the instance I think, so it could be different per server
$Service = Get-Service -ComputerName "<COMPUTER NAME HERE>" MySQL*
# If the Service is Running, Stop the service.
do {Stop-Service $Service -Force -PassThru; sleep 30; $ct = $ct + 1} while (($Service.Status -ne "Stopped") -and ($ct -lt 4))
However when I run the backup job manually it still fails. I also changed both powershell Execution policies on the Veeam Server and the target to Bypass.
Thank you, I checked the option to ignore failures and the VM got backed up. However I never see in the event log of the target system that it stops and/or starts the MySQL Service.
Please make sure that you've specified valid guest OS credentials, the account that is used for script execution have to have enough permissions in guest OS.
Alright, I switched the guest credentials even though the Veeam Service account has enough privileges. Even though I changed the credentials it continues to use the veeamsvc account. And Still fails
didn't work. Veeam complained that it "couldn't find the script file"
You should either use an absolute path to your script or perform "cd C:\script-dir" prior to calling the script.
Please try the following:
1. Place you PS script to your MySQL VM
2. Create .bat that calls your PS script
3. Specify that .bat as a pre-freeze script in you backup job settings
Another approach is to rewrite your MySQL stopping script to .bat format.
I have the same problem. I can not run the script PS1 in the Pre-freeze setings to stop and start DB in guest OS.
To test out trying to run the script PS1 witch has only one simple command
write-host "TEST"
I know I can write a BAT script and its stop and start service but if it is possible to choose on the Veeam Backup Server other types of scripts than BAT (PS1, VBS, etc.) it should also work.
I prefer scripts PS1 and do not want to use the other.
Does anyone from the company Veeam can describe the requirements to be able to run PowerShell scripts, in the manual is not too much information about it.
Usage of bat format is required for pre-freeze/post-thaw scripts. So, you need to convert your PS script to bat file (there are several articles in internet describing how you can do that) or copy the necessary PS files inside guest manually and leave just a few lines in bat file. Those will be needed to execute already copied scripts.
I do not understand some of that, if properly run only BAT scripts is what purpose you can select other types of PS1, VBS, JS ?
I think initially it's been implemented that way to ease selection of appropriate files. Say, for pre/post-job activity you can easily select a needed ps script and, then, just add Powershell.exe at the beginning of the command to make everything work properly. (see here)
Most likely, that dialog form has been added to pre-freeze/post-thaw script window without changes. However, those scripts being injected inserted inside guests are quite different and the behaviour described about doesn't work any longer and can even lead to unintended consequences.
We do understand the confusion caused by that and plan to address it in the next product release by modifying that dialog.
Is there an specific way to backup up MySQL on Windows 2012 VM? all Veeam documents for MySQL apply to MySQL on Linux VM. There are no scripts or bat files for Windows Server to freeze MySQL.
The basic idea behind the backup is the same - flush tables with read lock and take a VM snapshot afterwards, then release the lock. It doesn't really matter whether the database is on Windows or on Linux, you only might need to adjust syntax of those scripts so that they apply for Windows installations.