Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 2. Configuring Red Hat High Availability clusters on Microsoft Azure
Red Hat supports High Availability (HA) on Red Hat Enterprise Linux (RHEL) 7.4 and later versions. This chapter includes information and procedures for configuring a Red Hat HA cluster on Microsoft Azure using virtual machine (VM) instances as cluster nodes. The procedures in this chapter assume you are creating a custom image for Azure. You have a number of options for obtaining the RHEL 7 images to use for your cluster. For more information on image options for Azure, see Red Hat Enterprise Linux Image Options on Azure.
This chapter includes prerequisite procedures for setting up your environment for Azure. Once you have set up your environment, you can create and configure Azure VM instances.
This chapter also includes procedures specific to the creation of HA clusters, which transform individual VM nodes into a cluster of HA nodes on Azure. These include procedures for installing the High Availability packages and agents on each cluster node, configuring fencing, and installing Azure network resource agents.
This chapter refers to the Microsoft Azure documentation in a number of places. For many procedures, see the referenced Azure documentation for more information.
Prerequisites
- You need to install the Azure command line interface (CLI). For more information, see Installing the Azure CLI.
- Enable your subscriptions in the Red Hat Cloud Access program. The Red Hat Cloud Access program allows you to move your Red Hat subscriptions from physical or on-premise systems onto Azure with full support from Red Hat.
Additional resources
2.1. Creating resources in Azure Link kopierenLink in die Zwischenablage kopiert!
Complete the following procedure to create an availability set. You need these resources to complete subsequent tasks in this chapter.
Procedure
Create an availability set. All cluster nodes must be in the same availability set.
az vm availability-set create --name _MyAvailabilitySet_ --resource-group _MyResourceGroup_
$ az vm availability-set create --name _MyAvailabilitySet_ --resource-group _MyResourceGroup_Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Additional resources
2.2. Creating an Azure Active Directory Application Link kopierenLink in die Zwischenablage kopiert!
Complete the following procedures to create an Azure Active Directory (AD) Application. The Azure AD Application authorizes and automates access for HA operations for all nodes in the cluster.
Prerequisites
You need to install the Azure Command Line Interface (CLI).
Procedure
- Ensure you are an Administrator or Owner for the Microsoft Azure subscription. You need this authorization to create an Azure AD application.
Log in to your Azure account.
az login
$ az loginCopy to Clipboard Copied! Toggle word wrap Toggle overflow Enter the following command to create the Azure AD Application. To use your own password, add the
--passwordoption to the command. Ensure that you create a strong password.az ad sp create-for-rbac --name _FencingApplicationName_ --role owner --scopes "/subscriptions/_SubscriptionID_/resourceGroups/_MyResourseGroup_"
$ az ad sp create-for-rbac --name _FencingApplicationName_ --role owner --scopes "/subscriptions/_SubscriptionID_/resourceGroups/_MyResourseGroup_"Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Save the following information before proceeding. You need this information to set up the fencing agent.
- Azure AD Application ID
- Azure AD Application Password
- Tenant ID
- Microsoft Azure Subscription ID
Additional resources
2.3. Installing the Red Hat HA packages and agents Link kopierenLink in die Zwischenablage kopiert!
Complete the following steps on all nodes.
Procedure
Register the VM with Red Hat.
sudo -i subscription-manager register --auto-attach
$ sudo -i # subscription-manager register --auto-attachCopy to Clipboard Copied! Toggle word wrap Toggle overflow Disable all repositories.
subscription-manager repos --disable=*
# subscription-manager repos --disable=*Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enable the RHEL 7 Server and RHEL 7 Server HA repositories.
subscription-manager repos --enable=rhel-7-server-rpms subscription-manager repos --enable=rhel-ha-for-rhel-7-server-rpms
# subscription-manager repos --enable=rhel-7-server-rpms # subscription-manager repos --enable=rhel-ha-for-rhel-7-server-rpmsCopy to Clipboard Copied! Toggle word wrap Toggle overflow Update all packages.
yum update -y
# yum update -yCopy to Clipboard Copied! Toggle word wrap Toggle overflow Reboot if the kernel is updated.
reboot
# rebootCopy to Clipboard Copied! Toggle word wrap Toggle overflow Install
pcs,pacemaker,fence agent,resource agent, andnmap-ncat.yum install -y pcs pacemaker fence-agents-azure-arm resource-agents nmap-ncat
# yum install -y pcs pacemaker fence-agents-azure-arm resource-agents nmap-ncatCopy to Clipboard Copied! Toggle word wrap Toggle overflow
2.4. Configuring HA services Link kopierenLink in die Zwischenablage kopiert!
Complete the following steps on all nodes.
Procedure
The user
haclusterwas created during thepcsandpacemakerinstallation in the previous section. Create a password forhaclusteron all cluster nodes. Use the same password for all nodes.passwd hacluster
# passwd haclusterCopy to Clipboard Copied! Toggle word wrap Toggle overflow Add the
high availabilityservice to the RHEL Firewall iffirewalld.serviceis enabled.firewall-cmd --permanent --add-service=high-availability firewall-cmd --reload
# firewall-cmd --permanent --add-service=high-availability # firewall-cmd --reloadCopy to Clipboard Copied! Toggle word wrap Toggle overflow Start the
pcsservice and enable it to start on boot.systemctl enable pcsd.service --now
# systemctl enable pcsd.service --nowCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification step
Ensure the
pcsservice is running.systemctl is-active pcsd.service
# systemctl is-active pcsd.serviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow
2.5. Creating a cluster Link kopierenLink in die Zwischenablage kopiert!
Complete the following steps to create the cluster of nodes.
Procedure
On one of the nodes, enter the following command to authenticate the pcs user
hacluster. Specify the name of each node in the cluster.pcs host auth _hostname1_ _hostname2_ _hostname3_
# pcs host auth _hostname1_ _hostname2_ _hostname3_Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the cluster.
pcs cluster setup --name _hostname1_ _hostname2_ _hostname3_
# pcs cluster setup --name _hostname1_ _hostname2_ _hostname3_Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification steps
Enable the cluster.
pcs cluster enable --all
# pcs cluster enable --allCopy to Clipboard Copied! Toggle word wrap Toggle overflow Start the cluster.
pcs cluster start --all
# pcs cluster start --allCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.6. Creating a fence device Link kopierenLink in die Zwischenablage kopiert!
Complete the following steps to configure fencing from any node in the cluster.
Procedure
Identify the available instances that can be fenced.
fence_azure_arm -l [appid] -p [authkey] --resourceGroup=[name] --subscriptionId=[name] --tenantId=[name] -o list
# fence_azure_arm -l [appid] -p [authkey] --resourceGroup=[name] --subscriptionId=[name] --tenantId=[name] -o listCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example:
fence_azure_arm -l XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX -p XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX --resourceGroup=hacluster-rg --subscriptionId=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX --tenantId=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX -o list
[root@node1 ~]# fence_azure_arm -l XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX -p XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX --resourceGroup=hacluster-rg --subscriptionId=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX --tenantId=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX -o list node01-vm, node02-vm, node03-vm,Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a fence device. Use the
pcmk_host_mapcommand to map the RHEL host name to the instance ID.pcs stonith create _clusterfence_ fence_azure_arm login=_AD-Application-ID_ passwd=_AD-passwd_ pcmk_host_map="_pcmk-host-map_ resourcegroup= _myresourcegroup_ tenantid=_tenantid_ subscriptionid=_subscriptionid_
# pcs stonith create _clusterfence_ fence_azure_arm login=_AD-Application-ID_ passwd=_AD-passwd_ pcmk_host_map="_pcmk-host-map_ resourcegroup= _myresourcegroup_ tenantid=_tenantid_ subscriptionid=_subscriptionid_Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification steps
Test the fencing agent for one of the other nodes.
pcs stonith fence _azurenodename_
# pcs stonith fence _azurenodename_Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check the status to verify the node started.
watch pcs status
# watch pcs statusCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example:
watch pcs status
[root@node01 ~]# watch pcs status fenceazure (stonith:fence_azure_arm): Started nodeaCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Additional resources
2.7. Creating an Azure internal load balancer Link kopierenLink in die Zwischenablage kopiert!
The Azure internal load balancer removes cluster nodes that do not answer health probe requests.
Perform the following procedure to create an Azure internal load balancer. Each step references a specific Microsoft procedure and includes the settings for customizing the load balancer for HA.
Prerequisites
Access to the Azure control panel
Procedure
- Create a basic load balancer. Select Internal load balancer, the Basic SKU, and Dynamic for the type of IP address assignment.
- Create a backend address pool. Associate the backend pool to the availability set created while creating Azure resources in HA. Do not set any target network IP configurations.
- Create a health probe. For the health probe, select TCP and enter port 61000. You can use a TCP port number that does not interfere with another service. For certain HA product applications, for example, SAP HANA and SQL Server, you may need to work with Microsoft to identify the correct port to use.
- Create a load balancer rule. To create the load balancing rule, use the default values that are prepopulated. Ensure to set Floating IP (direct server return) to Enabled.
2.8. Configuring the Azure load balancer resource agent Link kopierenLink in die Zwischenablage kopiert!
After you have created the health probe, you must configure the load balancer resource agent. This resource agent runs a service that answers health probe requests from the Azure load balancer and removes cluster nodes that do not answer requests.
Procedure
Enter the
Azure idcommand to view the Azure load balancer resource agent description. This shows the options and default operations for this agent.pcs resource describe _azure-id_
# pcs resource describe _azure-id_Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create an
Ipaddr2resource for managing the IP on the node.pcs resource create _resource-id_ IPaddr2 ip=_virtual/floating-ip_ cidr_netmask=_virtual/floating-mask_ --group _group-id_ nic=_network-interface_ op monitor interval=30s
# pcs resource create _resource-id_ IPaddr2 ip=_virtual/floating-ip_ cidr_netmask=_virtual/floating-mask_ --group _group-id_ nic=_network-interface_ op monitor interval=30sCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example:
pcs resource create ClusterIP ocf:heartbeat:IPaddr2 ip=172.16.66.99 cidr_netmask=24 --group CloudIP nic=eth0 op monitor interval=30s
[root@node01 ~]# pcs resource create ClusterIP ocf:heartbeat:IPaddr2 ip=172.16.66.99 cidr_netmask=24 --group CloudIP nic=eth0 op monitor interval=30sCopy to Clipboard Copied! Toggle word wrap Toggle overflow Configure the
load balancerresource agent.pcs resource create _resource-loadbalancer-name_ azure-lb port=_port-number_ --group _cluster-resources-group_
# pcs resource create _resource-loadbalancer-name_ azure-lb port=_port-number_ --group _cluster-resources-group_Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification step
Run the
pcs statuscommand to see the results.pcs status
[root@node01 clouduser]# pcs statusCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Additional resources