4.8. Configuring shared block storage
To configure shared block storage for a Red Hat High Availability cluster with Microsoft Azure Shared Disks, use the following procedure. Note that this procedure is optional.
This is a standalone sample procedure for configuring block storage. The procedure assumes that you have not yet created your cluster.
Prerequisites
- You have three Azure VMs (a three-node cluster) with a 1 TB shared disk.
- You have the Azure CLI on your host system and created SSH key(s).
You must have created the cluster environment in Azure. To do so, follow the resources in this list:
Procedure
Create a shared block volume:
$ az disk create -g <resource_group> -n <shared_block_volume_name> --size-gb <disk_size> --max-shares <number_vms> -l <location>For example, the following command creates a shared block volume named
shared-block-volume.vhdin the resource groupsharedblockwithin the Azure Availability Zonewestcentralus.$ az disk create -g sharedblock-rg -n shared-block-volume.vhd --size-gb 1024 --max-shares 3 -l westcentralus { "creationData": { "createOption": "Empty", "galleryImageReference": null, "imageReference": null, "sourceResourceId": null, "sourceUniqueId": null, "sourceUri": null, "storageAccountId": null, "uploadSizeBytes": null }, "diskAccessId": null, "diskIopsReadOnly": null, "diskIopsReadWrite": 5000, "diskMbpsReadOnly": null, "diskMbpsReadWrite": 200, "diskSizeBytes": 1099511627776, "diskSizeGb": 1024, "diskState": "Unattached", "encryption": { "diskEncryptionSetId": null, "type": "EncryptionAtRestWithPlatformKey" }, "encryptionSettingsCollection": null, "hyperVgeneration": "V1", "id": "/subscriptions/12345678910-12345678910/resourceGroups/sharedblock-rg/providers/Microsoft.Compute/disks/shared-block-volume.vhd", "location": "westcentralus", "managedBy": null, "managedByExtended": null, "maxShares": 3, "name": "shared-block-volume.vhd", "networkAccessPolicy": "AllowAll", "osType": null, "provisioningState": "Succeeded", "resourceGroup": "sharedblock-rg", "shareInfo": null, "sku": { "name": "Premium_LRS", "tier": "Premium" }, "tags": {}, "timeCreated": "2020-08-27T15:36:56.263382+00:00", "type": "Microsoft.Compute/disks", "uniqueId": "cd8b0a25-6fbe-4779-9312-8d9cbb89b6f2", "zones": null }Verify the shared block volume:
$ az disk show -g <resource_group> -n <shared_block_volume_name>For example, the following command shows details for the shared block volume
shared-block-volume.vhdwithin the resource groupsharedblock-rg.$ az disk show -g sharedblock-rg -n shared-block-volume.vhd { "creationData": { "createOption": "Empty", "galleryImageReference": null, "imageReference": null, "sourceResourceId": null, "sourceUniqueId": null, "sourceUri": null, "storageAccountId": null, "uploadSizeBytes": null }, "diskAccessId": null, "diskIopsReadOnly": null, "diskIopsReadWrite": 5000, "diskMbpsReadOnly": null, "diskMbpsReadWrite": 200, "diskSizeBytes": 1099511627776, "diskSizeGb": 1024, "diskState": "Unattached", "encryption": { "diskEncryptionSetId": null, "type": "EncryptionAtRestWithPlatformKey" }, "encryptionSettingsCollection": null, "hyperVgeneration": "V1", "id": "/subscriptions/12345678910-12345678910/resourceGroups/sharedblock-rg/providers/Microsoft.Compute/disks/shared-block-volume.vhd", "location": "westcentralus", "managedBy": null, "managedByExtended": null, "maxShares": 3, "name": "shared-block-volume.vhd", "networkAccessPolicy": "AllowAll", "osType": null, "provisioningState": "Succeeded", "resourceGroup": "sharedblock-rg", "shareInfo": null, "sku": { "name": "Premium_LRS", "tier": "Premium" }, "tags": {}, "timeCreated": "2020-08-27T15:36:56.263382+00:00", "type": "Microsoft.Compute/disks", "uniqueId": "cd8b0a25-6fbe-4779-9312-8d9cbb89b6f2", "zones": null }Create three network interfaces. Run the following command three times by using a different
<nic_name>for each node:$ az network nic create \ -g <resource_group> -n <nic_name> --subnet <subnet_name> \ --vnet-name <virtual_network> --location <location> \ --network-security-group <network_security_group> --private-ip-address-version IPv4For example, the following command creates a network interface with the name
shareblock-nodea-vm-nic-protected.$ az network nic create \ -g sharedblock-rg -n sharedblock-nodea-vm-nic-protected --subnet sharedblock-subnet-protected \ --vnet-name sharedblock-vn --location westcentralus \ --network-security-group sharedblock-nsg --private-ip-address-version IPv4Create three VMs and attach the shared block volume. Option values are the same for each VM except that each VM has its own
<vm_name>,<new_vm_disk_name>, and<nic_name>:$ az vm create \ -n <vm_name> -g <resource_group> --attach-data-disks <shared_block_volume_name> \ --data-disk-caching None --os-disk-caching ReadWrite --os-disk-name <new_vm_disk_name> \ --os-disk-size-gb <disk_size> --location <location> --size <virtual_machine_size> \ --image <image_name> --admin-username <vm_username> --authentication-type ssh \ --ssh-key-values <ssh_key> --nics <nic_name> --availability-set <availability_set> --ppg <proximity_placement_group>For example, the following command creates a VM named
sharedblock-nodea-vm:$ az vm create \ -n sharedblock-nodea-vm -g sharedblock-rg --attach-data-disks shared-block-volume.vhd \ --data-disk-caching None --os-disk-caching ReadWrite --os-disk-name sharedblock-nodea-vm.vhd \ --os-disk-size-gb 64 --location westcentralus --size Standard_D2s_v3 \ --image /subscriptions/12345678910-12345678910/resourceGroups/sample-azureimagesgroupwestcentralus/providers/Microsoft.Compute/images/sample-azure-rhel-10.3.0-20200713.n.0.x86_64 --admin-username sharedblock-user --authentication-type ssh \ --ssh-key-values @sharedblock-key.pub --nics sharedblock-nodea-vm-nic-protected --availability-set sharedblock-as --ppg sharedblock-ppg { "fqdns": "", "id": "/subscriptions/12345678910-12345678910/resourceGroups/sharedblock-rg/providers/Microsoft.Compute/virtualMachines/sharedblock-nodea-vm", "location": "westcentralus", "macAddress": "00-22-48-5D-EE-FB", "powerState": "VM running", "privateIpAddress": "198.51.100.3", "publicIpAddress": "", "resourceGroup": "sharedblock-rg", "zones": "" }
Verification
For each VM in your cluster, verify that the block device is available. To do so, connect to the vm by using the
sshcommand with your VM’s IP address:# ssh <ip_address> "hostname ; lsblk -d | grep ' 1T '"For example, the following command lists details including the hostname and block device for the VM IP
198.51.100.3:# ssh 198.51.100.3 "hostname ; lsblk -d | grep ' 1T '" nodea sdb 8:16 0 1T 0 diskUse the
sshutility to verify that each VM in your cluster uses the same shared disk:# ssh <ip_address> "hostname ; lsblk -d | grep ' 1T ' | awk '{print \$1}' | xargs -i udevadm info --query=all --name=/dev/{} | grep '^E: ID_SERIAL='"For example, the following command lists details including the hostname and shared disk volume ID for the instance IP address
198.51.100.3:# ssh 198.51.100.3 "hostname ; lsblk -d | grep ' 1T ' | awk '{print \$1}' | xargs -i udevadm info --query=all --name=/dev/{} | grep '^E: ID_SERIAL='" nodea E: ID_SERIAL=3600224808dd8eb102f6ffc5822c41d89After you verify that each VM connects to the shared disk, you can configure resilient storage for the cluster.