Skip to main content
Our Tech Ideas

Differences between configuring Always On Availability Groups on a physical and Azure virtual machine

Differences between configuring Always On Availability Groups on a physical and Azure virtual machine

Introduction

In today’s data-driven world, ensuring high availability and data protection is paramount for businesses. Microsoft SQL Server offers a robust solution called Always On Availability Groups that enables the creation of a highly available and resilient database environment. However, the configuration process varies between physical machines and Azure virtual machines. In this blog post, we will delve into the step-by-step differences in configuring Always On Availability Groups on physical machines and Azure virtual machines, providing you with a comprehensive guide to implement this powerful feature.

Configuring Always On Availability on a Physical Machine

  1. Prepare the physical servers:
    To start, ensure you have two or more physical servers with compatible hardware and operating systems. Meeting the system requirements for the version of SQL Server you plan to install is crucial.
  2. Install SQL Server:
    Install SQL Server on each physical machine, carefully following the installation procedure. Configure the necessary components, including the database engine and SQL Server Agent, during the installation process.
  3. Configure Windows Failover Clustering:
    Set up Windows Failover Clustering on the physical servers to create a cluster. Join each physical machine to the same Active Directory domain, install the Failover Clustering feature, and create a new cluster using the Failover Cluster Manager.
  4. Configure storage:
    To enable shared storage, such as a Storage Area Network (SAN), connect it to each physical machine and ensure it is visible to all cluster nodes. Properly configuring and validating the shared storage using the Failover Cluster Manager is crucial. *** Always On availability groups does not depend on any form of shared storage. However, if you use a SQL Server failover cluster instance (FCI) to host one or more availability replicas, each of those FCIs will require shared storage as per standard SQL Server failover cluster instance installation. Ref. https://learn.microsoft.com/
  5. Enable Always On Availability Groups:
    Enable the Always On Availability Groups feature on each SQL Server instance participating in the availability group. This involves configuring the appropriate settings, such as enabling the feature in SQL Server Configuration Manager.
  6. Create an availability group:
    Using SQL Server Management Studio (SSMS) or Transact-SQL, create the availability group by specifying the primary and secondary replicas, database synchronization settings, and backup preferences.
  7. Add databases to the availability group:
    Select the databases you wish to include in the availability group, ensuring they are synchronized and meet the prerequisites for availability group participation. Configure the synchronization mode, such as synchronous or asynchronous, for each database.
  8. Configure listeners:
    Set up a virtual network name (VNN) and IP address as a listener for the availability group. This allows clients to connect to the primary replica regardless of its physical location.
  9. Test the failover:
    Perform failover tests to validate the high availability and data synchronization of the availability group. Simulate failures and monitor the behavior of the availability group during the failover process, ensuring seamless client connections to the new primary replica.

Configuring Always On Availability on an Azure Virtual Machine

  1. Create Azure Virtual Network:
    Set up an Azure Virtual Network (VNet) to establish communication between the virtual machines. Define the IP address range, subnets, and network security groups within the VNet. Ensure that the virtual machines are assigned to the same VNet.
  2. Provision Azure virtual machines:
    Create two or more Azure virtual machines with compatible hardware and operating systems. Consider factors such as CPU, memory, storage capacity, and networking capabilities when selecting the virtual machine sizes.
  3. Provision Azure Storage:
    Provision Azure Storage, such as Azure Managed Disks or Azure Blob Storage, to store database files and transaction logs. Choose the appropriate storage type and configuration based on performance and durability requirements.
  4. Install SQL Server on Azure VMs:
    Create Azure virtual machines based on the desired operating system. Install SQL Server on each Azure virtual machine, configuring the necessary components during the installation process.
  5. Configure Windows Failover Clustering:
    Set up Windows Failover Clustering on the Azure virtual machines. Join each virtual machine to the same Azure Active Directory domain, install the Failover Clustering feature, and create a new cluster using the Failover Cluster Manager.
  6. Enable Always On Availability Groups:
    Enable the Always On Availability Groups feature on each SQL Server instance participating in the availability group. Configure the necessary settings in SQL Server Configuration Manager.
  7. Create an availability group:
    Using SSMS or Transact-SQL, create the availability group by specifying the primary and secondary replicas, database synchronization settings, and backup preferences.
  8. Add databases to the availability group:
    Select the databases you want to include in the availability group, ensuring they meet the prerequisites for availability group participation. Configure the synchronization mode for each database.
  9. Configure Azure Load Balancer:
    Set up an Azure Load Balancer to distribute incoming connections across the availability group replicas. Define the frontend IP configuration, backend pool, health probe, and load balancing rules in the Azure Load Balancer settings.
  10. Configure listeners:
    Set up an Azure Internal Load Balancer (ILB) or Azure Traffic Manager as a listener for the availability group. Configure the ILB to route traffic to the virtual machines within the availability group. Define appropriate routing methods and endpoints for each availability group replica using Traffic Manager.
  11. Availability group deployments to multiple subnets don’t require a load balancer. In a single-subnet environment, customers who use SQL Server 2019 CU8 and later on Windows 2016 and later can replace the traditional virtual network name (VNN) listener and Azure Load Balancer with a distributed network name (DNN) listener. If you want to use a DNN, skip any tutorial steps that configure Azure Load Balancer for your availability group. Ref. https://learn.microsoft.com/
  12. Test the failover:
    Perform failover tests to validate high availability and data synchronization within the Azure infrastructure. Simulate failures, monitor the availability group behavior during failover, and ensure seamless client connections to the new primary replica.

Conclusion

Implementing Always On Availability Groups provides businesses with a powerful solution for achieving high availability and data protection. By following the step-by-step differences outlined above, you can configure Always On Availability Groups on physical machines or Azure virtual machines successfully. Whether you opt for physical infrastructure or embrace the flexibility of the cloud, your databases will benefit from enhanced resilience and seamless failover capabilities, ensuring uninterrupted access to critical data.

Remember to consult official documentation and specific resources for your SQL Server and Azure versions to ensure accuracy and compatibility with your environment.

Additional Note

Key Differences between Configuring Always On Availability Groups on Physical Machines and Azure Virtual Machines

While the overall steps for configuring Always On Availability Groups are similar between physical machines and Azure virtual machines, there are some notable differences to consider:

  1. Infrastructure: On physical machines, you need to ensure compatible hardware, set up shared storage, and configure Windows Failover Clustering. In contrast, Azure virtual machines leverage the cloud infrastructure, eliminating the need for physical hardware and providing Azure-specific components like Azure Virtual Networks and Azure Storage.
  2. Networking: Physical machines require joining nodes to the same Active Directory domain, whereas Azure virtual machines can use Azure Active Directory domain services or Azure AD integration for authentication. Azure Virtual Networks are used for network communication between virtual machines, and Azure Load Balancer or Azure Traffic Manager handle load balancing and traffic distribution.
  3. Storage: Physical machines typically rely on shared storage such as a Storage Area Network (SAN) for database files and transaction logs. Azure virtual machines can utilize Azure Managed Disks or Azure Blob Storage for storage requirements, offering flexibility and scalability in the cloud.
  4. Listener Configuration: Physical machines use a virtual network name (VNN) and IP address as the listener for the availability group. Azure virtual machines leverage Azure Internal Load Balancer (ILB) or Azure Traffic Manager as the listener, providing load balancing and routing capabilities within the Azure infrastructure.
  5. High Availability: Physical machines depend on Windows Failover Clustering to provide high availability, while Azure virtual machines leverage the underlying Azure infrastructure for fault tolerance. Azure Availability Sets or Azure Availability Zones ensure that virtual machines are deployed across multiple fault domains or availability zones, reducing the risk of a single point of failure.
  6. Scalability: Azure virtual machines offer scalability options such as increasing the number of virtual machines in an availability group or leveraging auto-scaling capabilities based on workload demand. Physical machines may require additional hardware provisioning and scaling considerations.

By understanding these key differences, you can make informed decisions when configuring Always On Availability Groups, whether on physical machines or in the Azure cloud. The flexibility, scalability, and built-in Azure services provide unique advantages when deploying availability groups on Azure virtual machines.

For more visit: Tutorial: Manually configure an availability group – SQL Server on Azure VMs