Skip to main content

High Availability Automated Config B&R with Veeam V12.1


Continuous Resilience:
High Availability through Automated Config Backup and Restore in Veeam V12.1

Introduction:

In this post of Veeam Backup and Replication Version 12.1, we'll uncover the importance of Disaster Recovery (DR) and High Availability (HA) strategies, emphasizing the role of the configuration database. While Veeam's self-describing metadata facilitates individual backup recoveries, safeguarding the configuration database ensures seamless continuity of day-to-day operations in the face of primary server failures.

Understanding the Role of Configuration Database:

Veeam's configuration database is an important component that holds critical information about the connected infrastructure, job configurations, and operational settings. Although individual backups can be restored without the configuration database, its presence is crucial for maintaining the larger operational context of data protection.

The Significance of Configuration Database in DR and HA:

Why Auto Restore Config Database? 

In the event of a Primary VBR server failure:

  1. Seamless Transition to Secondary VBR:
    The availability of the configuration database enables a swift transition to the Secondary VBR, ensuring uninterrupted backup operations.

  2. Continuity of Day 2 Operations:
    Day 2 operations, such as scheduled backups and job configurations, rely on the information stored in the configuration database. With a Secondary VBR server, these operations continue seamlessly.

  3. Resilience in Infrastructure Changes:
    The configuration database captures the intricacies of the connected infrastructure. In case of server changes or failures, having a replicated configuration database ensures minimal disruption and efficient recovery.

 Veeam Config Backup & Restore for Availability

Let's start: we will do the following steps in this guide:

  1. Create a Config Backup on Primary VBR:
  2. Create a File Copy Job to Secondary VBR:
  3. Schedule Jobs and Run File Copy:
  4. Initiate Manual Restore on Secondary VBR:
  5. Export Config Answer File for Secondary & Continuous Update:
  6. Reviewing the Answer File and Additional Settings: 
  7. Create a Scheduled Task on Secondary: 
  8. Add Script to Find Latest Config Backup and Restore:
  9. Testing the Configuration & HA

Create a Config Backup on Production VBR



Here we are using a Linux repository as my backup destination for the VBR config. This is important as this will be the source for my file copy job.

Create a File Copy Job to My Secondary VBR



We give the job a simple name. Confirm the source and select the destination, which is my DR VBR server. I created a folder called PrimaryVBRconf; this will be the target for the file copy Job.

Schedule Jobs and Run File Copy



Because I run the config backup at the primary VBR server daily at 10 PM, I will set my file copy to run at 11 PM and my automated task on DR VBR to restore the latest config at midnight.



We confirm the source & we select the destination, which is my DR VBR server, I created a folder called PrimaryVBRconf , this will be the target for the file copy Job.



Let’s run the file copy job & see it copy data to Secondary VBR 



If we look under the files tab on Production VBR UI for Secondary VBR , we can see the config files were copied.



So let's initiate a manual restore of config on Secondary VBR to get the Answer file for automation.

 


We will use the Migrate option as this is a different host. Select the latest point.



Followed through the wizard, and we want the answer file at the final step.

Export Answer Config File for Secondary & Continuous Update



If we look into the Answer file, we can see XML config that will instruct the restore process on what to do.

Reviewing the Answer File and Additional Settings


Review the answer file; all data is static, so it would work fine every time. However, the config file to use for restoring is based on that restore session, and we can expect newer files as newer config backups are taken.

property name="CONFIGURATION_FILE" value="C:\PrimaryVBRconf\VBR12a\VBR12a_2023-11-28_05-13-52.bco"

Few additional settings that need change:

    <!--[Optional] Parameter SERVICES_AUTOSTART specifies if Veeam Backup & Replication should start automatically after migration. If you do not specify this parameter, default value '1' is used.-->
    <!--Supported values: 0 for No/1 for Yes-->
    <property value="0" name="SERVICES_AUTOSTART"/>
    
    ##We don’t want Secondary VBR services to start and conflict Primary VBR. 
    
    <unattendedConfigurationRestore mode="migrate"/>
    <!--[Optional] Parameter mode specifies a restore mode: 'restore' for Restore Mode, 'migrate' for Migrate Mode.-->
    <!--Supported values: restore/migrate-->
    
    ##We want it to be a Migration not a restore. 
    
    <!--[Optional] Parameter SWITCH_TO_RESTORE_MODE specifies if configuration restore should switch to restore mode if enabled backup jobs are found. If you do not specify this parameter, default value '2' is used.-->
    <!--Supported values: 0 for No/1 for Yes/2 for Cancel-->
    <property value="0" name="SWITCH_TO_RESTORE_MODE"/>
    
    ##We don't want it to switch back to Restore mode; it must force Migration option 
    


Let's Create a Scheduled Task on Secondary VBR



This we make run 30 minute after the File Copy Job runs.



Lets  add a script that finds latest config backup in copy directory, it appends the XML answer file with latest Config backup file found, then runs unattended Config restore using answer file:



Argument is the path to PS file: -File "C:\PrimaryVBRconf\VBR12a\Failover.ps1"

Here is the PS file content:

Start-Transcript -path "C:\PrimaryVBRconf\VBR12a\logs\task.log" -append
# Get config files, sort by size, and select the last one (largest)
$largestConfigFile = Get-ChildItem -Path "C:\PrimaryVBRconf\VBR12a\" -Filter *.bco | Sort-Object Length | Select-Object -Last 1

$filePath = "C:\PrimaryVBRconf\VBR12a\DRConfig.xml"

# Load XML content
[xml]$xmlContent = Get-Content -Path $filePath

# Find the element with the CONFIGURATION_FILE property and update its value
$propertyElement = $xmlContent.SelectNodes('//property[@name="CONFIGURATION_FILE"]')
if ($propertyElement -ne $null) {
    $propertyElement.SetAttribute('value', $largestConfigFile.FullName)
}

# Save the updated XML content back to the file
$xmlContent.Save($filePath)

# Invoke the executable with the file path
& "C:\Program Files\Veeam\Backup and Replication\Backup\Veeam.Backup.Configuration.UnattendedRestore.exe" /file:$filePath

Stop-Transcript

Note: There is a Log file path to check the task success once automated.

Lets Test the Configuration:

I have added a new job to Primary VBR:



If we look at the Secondary VBR, you can see the Job doesn't exist yet:



Let's run a config Backup manually, followed by kicking off the File copy Job, then start a task in Windows Secondary to run unattended restore with the latest config of primary.

Config Backup has run on primary, and we can see that new BCO file under files on the primary repository:



Next, we run File copy for BCO from primary to secondary:



Let's manually start the automated task on the secondary:



Once you start all services on Secondary and log into the console, you can see the new job has been restored across:



Conclusion:

This could be used to create an HA or active-passive VBR server environment for a quick failover using redundant DB setup or each VBR with its own. Another option is to have shared storage for config backup; this way, you don’t need to run the File copy job.

Hope this post was insightful. Please comment, share, and thanks for reading!


Comments