Home NewsX General Availability of Flexible Maintenance for Azure Database for MySQL – Flexible Server

General Availability of Flexible Maintenance for Azure Database for MySQL – Flexible Server

by info.odysseyx@gmail.com
0 comment 5 views


We are pleased to announce this. Flexible Maintenance Azure Database for MySQL – Flexible Server is now available Generally Available (GA)! This new feature provides greater control over the timing of maintenance activities performed on database instances, allowing customers to tailor maintenance schedules to their operational requirements.

During the public preview, we received extensive feedback that helped us improve and enhance GA’s functionality. We incorporated several important updates to ensure a smoother and more flexible maintenance experience.

Key features of GA

Change schedule via Azure CLI

With the GA release, users can now reschedule maintenance activities via the Azure CLI, providing flexibility and automation in managing maintenance windows across multiple servers.

Extended schedule change window

The rebalancing period has been extended to include all possible maintenance dates within the region, providing much more flexibility than the limited 14-day period provided in the public preview.

Demo: Bulk re-balancing maintenance using scripts

One of the most powerful features introduced in GA is the ability to automate the rescheduling of maintenance activities for multiple servers within a subscription or a specific resource group. Below is a script that can be used to bulk reschedule maintenance for all servers within a subscription or resource group.

#!/bin/bash

# Function to display usage information
usage() {
    echo "Usage: $0 -s  [-g ] -t  -m "
    echo "  -s: Subscription ID (required)"
    echo "  -g: Resource group name (optional, if not specified all resource groups will be iterated)"
    echo "  -t: Maintenance start time in 'YYYY-MM-DDTHH:MM:SSZ' format (required)"
    echo "  -m: Maintenance name (required)"
    exit 1
}

# Parse command-line arguments
while getopts "s:g:t:m:" opt; do
    case $opt in
        s) SUBSCRIPTION_ID="$OPTARG" ;;
        g) RESOURCE_GROUP="$OPTARG" ;;
        t) START_TIME="$OPTARG" ;;
        m) MAINTENANCE_NAME="$OPTARG" ;;
        *) usage ;;
    esac
done

# Ensure required parameters are provided
if [ -z "$SUBSCRIPTION_ID" ] || [ -z "$START_TIME" ] || [ -z "$MAINTENANCE_NAME" ]; then
    echo "Error: Subscription ID, maintenance start time, and maintenance name are required"
    usage
fi

# Set the Azure CLI subscription
az account set --subscription $SUBSCRIPTION_ID

# If no resource group is specified, retrieve all resource groups
if [ -z "$RESOURCE_GROUP" ]; then
    resource_groups=$(az group list --query "[].name" -o tsv)
else
    resource_groups=$RESOURCE_GROUP
fi

# Iterate through each resource group
for rg in $resource_groups; do
    echo "Checking resource group: $rg"

    # List all MySQL Flexible Servers in the current resource group
    mysql_servers=$(az mysql flexible-server list --resource-group $rg --query "[].name" -o tsv)
    
    if [ -n "$mysql_servers" ]; then
        for server in $mysql_servers; do
            echo "Attempting to reschedule maintenance for MySQL Flexible Server '$server' in resource group '$rg'."
            
            # Construct the CLI command
            command="az mysql flexible-server maintenance reschedule --resource-group $rg --server-name $server --maintenance-name $MAINTENANCE_NAME --start-time $START_TIME"
            
            # Print the command that will be executed
            echo "Running command: $command"
            
            # Execute the command and handle errors
            if eval $command; then
                echo "Successfully rescheduled maintenance for server '$server'."
            else
                echo "Failed to reschedule maintenance for server '$server'." >&2
            fi
        done
    else
        echo "No MySQL Flexible Servers found in resource group '$rg'."
    fi

    echo "---------------------------------------"
done

How to use scripts

Save the script

Copy the script above and save it as a file with a .sh extension (e.g. reschedule_maintenance.sh).

Make the script executable

After saving the script, you need to make it executable by running the following command:

chmod +x reschedule_maintenance.sh

Run the script

After making the script executable, you can run it by passing the required parameters.

./reschedule_maintenance.sh -s  -g  -t "2024-09-21T09:00:00Z" -m 

This command contains the following parameters:

-s: Azure subscription ID.

-g: Resource group name (optional). If not provided, the script will iterate through all resource groups.

-t: Maintenance start time in YYYY-MM-DDTHH:MM:SSZ format.

-m: Maintenance name (tracking ID) obtained from the portal, CLI, or maintenance notification email.

Note on the -m parameter

The -m parameter refers to: Maintenance Tracking IDIdentifies a specific maintenance task. You can retrieve this tracking ID in the following ways:

  • at Maintenance Notification Email Sent from Azure.
  • Check it out Azure Portal It’s under the Maintenance blade on your server.
  • List maintenance details for a server using Azure CLI commands.

For the same maintenance cycle in a region, the tracking ID is the same across all servers. Therefore, if you have multiple servers in the same region, you can use the same -m value across all servers.

Viewing maintenance status via CLI

In addition to rescheduling, you can also use the CLI to: View maintenance status in bulk All servers in a resource group. This allows you to see all maintenance schedules without having to manually navigate the portal.

Please see the documentation for more information on how to check maintenance status and automate maintenance tasks. az mysql flexible server maintenance.

conclusion

With the GA release of Flexible Maintenance, you now have complete control over when maintenance is performed on your Azure Database for MySQL Flexible Servers. Additional features such as Azure CLI integration for rescheduling and an expanded rescheduling window make it simpler and more effective to manage maintenance.

Try out this new feature and streamline your maintenance processes by leveraging automation tools like the provided scripts. Read the article for more details. Scheduled Maintenance – Azure Database for MySQL – Flexible Server.

If you have any questions or suggestions, please leave a comment below or contact us directly. AskAzureDBforMySQL@service.microsoft.com.





Source link

You may also like

Leave a Comment

Our Company

Welcome to OdysseyX, your one-stop destination for the latest news and opportunities across various domains.

Newsletter

Subscribe my Newsletter for new blog posts, tips & new photos. Let's stay updated!

Laest News

@2024 – All Right Reserved. Designed and Developed by OdysseyX