3.4.  Setting up Red Hat Gluster Storage in Microsoft Azure in ARM Mode

This section provides step-by-step instructions to set up Red Hat Gluster Storage in Microsoft Azure in the Azure Resource Manager mode.

Note

There are two deployment modes in Microsoft Azure: Azure Service Management (ASM) mode (sometimes referred to as Azure Classic) and Azure Resource Manager (ARM) mode. The procedure in this section uses ARM mode and ARM cross-platform command-line interface (Xplat-CLI) commands to deploy a Red Hat Gluster Storage into Microsoft Azure. The Xplat-CLI commands differ slightly between these two deployment modes. If you want to set up the Red Hat Gluster Storage in Microsoft Azure using Azure Service Management (ASM) mode, refer to Section 3.6, “ Appendix - Setting up Red Hat Gluster Storage in Microsoft Azure in ASM Mode”.

3.4.1. Obtaining Red Hat Gluster Storage for Microsoft Azure

To download the Red Hat Gluster Storage Server files using a Red Hat Subscription or a Red Hat Evaluation Subscription:
  1. Visit the Red Hat Customer Service Portal at https://access.redhat.com/login and enter your user name and password to log in.
  2. Click Downloads to visit the Software & Download Center.
  3. In the Red Hat Gluster Storage Server area, click Download Software to download the latest version of the VHD image.
  4. Navigate to the directory where the file was downloaded and execute the sha256sum command on the file.
    For example,
    $ sha256sum rhgs-azure-3.4-rhel-7-x86_64.tar.gz
    2d083222d6a3c531fa2fbbd21c9ea5b2c965d3b8f06eb8ff3b2b0efce173325d rhgs-azure-3.4-rhel-7-x86_64.tar.gz
    
    The value generated by the sha256sum utility must match the value displayed on the Red Hat Customer Portal for the file. If they are not the same, your download is either incomplete or corrupt, and you will need to download the file again. If the checksum is not successfully validated after several attempted downloads, contact Red Hat Support for assistance.
  5. Unzip the downloaded file rhgs-azure-[version].zip to extract the archive contents.
    For example,
    # tar -xvzf rhgs-azure-3.4-rhel-7-x86_64.tar.gz

3.4.2.  Setting Up New Resources in Microsoft Azure

You must install the Azure cross-platform command-line interface (Xplat-CLI) before setting up new resources in Microsoft Azure. The steps to install the Azure Xplat-CLI and set up new resources in Microsoft Azure are provided at https://access.redhat.com/articles/2706961#install-the-azure-cross-platform-cli-2
Before you can upload the Microsoft Azure VHD, you need to have resources for the VM created in Microsoft Azure. All of the following steps are completed from your Microsoft Azure Administration Server.
  1. Create a resource group.
    # azure group create -l [azure-region] -n [resource-group]
    For example,
    # azure group create -l eastus -n rhgsarm
    info: Executing command group create
    + Getting resource group rhgsarm
    + Creating resource group rhgsarm
    info: Created resource group rhgsarm
    data: Id: /subscriptions/2586c64b-38b4-4527-a140-012d49dfc02c/resourceGroups/rhgsarm
    data: Name: rhgsarm
    data: Location: eastus
    data: Provisioning State: Succeeded
    data: Tags: null
    data:
    info: group create command OK
  2. Create a storage account. The following command sets up a few details that allow you to identify the replication option you want to use. Refer to Microsoft's Account Replication Options article at https://azure.microsoft.com/en-us/documentation/articles/storage-redundancy/
    # azure storage account create --sku-name [LRS, ZRS, GRS, RA-GRS] --kind [Storage, Blob Storage] -l [azure-region] -g [resource-group] [account-name]
    For example,
    # azure storage account create --sku-name LRS --kind Storage -l eastus -g rhgsarm rhgsstorage
    info: Executing command storage account create
    + Checking availability of the storage account name
    + Creating storage account
    info: storage account create command OK
  3. Get the storage account keys to use in the next step.
    # azure storage account keys list -g [resource-group] [account-name]
    For example,
        # azure storage account keys list -g rhgsarm rhgsstorage
    info: Executing command storage account keys list
    + Getting storage account keys
    data: Name Key Permissions
    data: ---- ---------------------------------------------------------------------------------------- -----------
    data: key1 ba8zt8LSUznaGX92DV1zWhj3ikrpIQEsZXxmNQcd194JaD/NgSwueVVmPfAjOMptpu3fDR/7olT2smo/9ZON+w== Full
    data: key2 5r+wVkfzb8S6oBpZCo9vQSuVhyNLuaOcfpOR048zWnRr8kAsTs7Vp72C/IdWGGQE9IiKrFXxPaDb5GosaA3Zeg== Full
    info: storage account keys list command OK
    
    Microsoft Azure generates two keys, both of which allow access to your storage container. Microsoft Azure generates two keys for key regeneration purposes. During regeneration, you use one key for secure access, while Microsoft Azure regenerates and creates a new key. Once there is a new key, you switch to that key and regenerate the other key the next time, and so forth. This is like changing your password for your Microsoft Azure storage container. You should do this periodically, but do not do it now because you just created the two keys. For information on keys and key regeneration, refer to Microsoft's Storage Connection Strings. article at https://azure.microsoft.com/en-us/documentation/articles/storage-configure-connection-string/.
  4. Export the key. Copy the key1 string created in the previous step and paste it in the AccountKey= file.
    # export AZURE_STORAGE_CONNECTION_STRING="DefaultEndpointsProtocol=https;AccountName=[account-name];AccountKey=[storage-account-key]"
    
    For example,
    # export AZURE_STORAGE_CONNECTION_STRING="DefaultEndpointsProtocol=https;AccountName=rhgsstorage;AccountKey=ba8zt8LSUznaGX92DV1zWhj3ikrpIQEsZXxmNQcd194JaD/NgSwueVVmPfAjOMptpu3fDR/7olT2smo/9ZON+w=="
    
  5. Create the storage container.
    # azure storage container create [container-name]
    For example,
        # azure storage container create rhgscontainer
    info: Executing command storage container create
    + Creating storage container rhgscontainer
    + Getting storage container information
    data: {
    data: name: 'rhgscontainer',
    data: metadata: {},
    data: etag: '"0x8D44F1EAD8604B4"',
    data: lastModified: 'Tue, 07 Feb 2017 06:00:54 GMT',
    data: lease: { status: 'unlocked', state: 'available' },
    data: requestId: '124a5521-0001-007a-3507-81b138000000',
    data: publicAccessLevel: 'Off'
    data: }
    info: storage container create command OK
  6. Create the Microsoft Azure virtual network.
    # azure network vnet create -g [resource-group] -l [azure-region] -a [CIDR-address-prefixe-vnet] [vnet-name]
    For example,
    # azure network vnet create -g rhgsarm -l eastus -a 10.0.0.0/8 rhgsvnet1
    info: Executing command network vnet create
    + Looking up the virtual network "rhgsvnet1"
    + Creating virtual network "rhgsvnet1"
    data: Id :
    /subscriptions/2586c64b-38b4-4527-a140-012d49dfc02c/resourceGroups/rhgsarm/providers/Microsoft.Network/virtualNetworks/rhgsvnet1
    data: Name : rhgsvnet1
    data: Type : Microsoft.Network/virtualNetworks
    data: Location : eastus
    data: Provisioning state : Succeeded
    data: Address prefixes:
    data: 10.0.0.0/8
    info: network vnet create command OK
    
  7. Create the subnet for the Microsoft Azure virtual network.
    # azure network vnet subnet create -g [resource-group] -e [vnet-name] -a [CIDR-address-prefix-subnet] [subnet-name]
    For example,
    # azure network vnet subnet create -g rhgsarm -e rhgsvnet1 -a 10.0.1.0/24 rhgssubnet1
    info: Executing command network vnet subnet create
    + Looking up the virtual network "rhgsvnet1"
    + Looking up the subnet "rhgssubnet1"
    + Creating subnet "rhgssubnet1"
    data: Id : /subscriptions/2586c64b-38b4-4527-a140-012d49dfc02c/resourceGroups/rhgsarm/providers/Microsoft.Network/virtualNetworks/rhgsvnet1/subnets/rhgssubnet1
    data: Name : rhgssubnet1
    data: Provisioning state : Succeeded
    data: Address prefix : 10.0.1.0/24
    info: network vnet subnet create command OK
    

    Important

    The storage connection key persists through the following procedure if you do not shut down your machine. If you shut down prior to completing the procedure, you need to pass your key (-k "[storage-account-key]") in the following commands. You can add your keys to a configuration file to load them each time your machine boots

3.4.3. Uploading the Disk Image to Microsoft Azure

The disk image can be uploaded and used as a template for creating Gluster Storage nodes. To upload the image to Microsoft Azure, navigate to the directory where the VHD image is stored and run the following command:
# azure storage blob upload -t page -a [account-name] --container [container-name] -b [azure-image-name].vhd [path to image-name].vhd

Note

This could take some time, depending on how fast your upload speeds are.
For example,
# azure storage blob upload -t page -a rhgsstorage --container rhgscontainer -b rhgsimage72.vhd rhgs-azure-cluster.vhd
info:    Executing command storage blob upload
+ Checking blob rhgsimage72.vhd in container rhgscontainer
+ Uploading rhgs-azure-cluster.vhd to blob rhgsimage72.vhd in container rhgscontainer
+ Getting storage blob information
data:    Property       Value
data:    -------------  ------------------------
data:    container      rhgscontainer
data:    name           rhgsimage72.vhd
data:    blobType       PageBlob
data:    contentLength  21475885568
data:    contentType    application/octet-stream
data:    contentMD5     G965mhnwQtBZVl6oRW3tpw==
info:    storage blob upload command OK

3.4.4.  Deploy the Gluster Storage Instances

Individual Gluster Storage instances in Microsoft Azure can be configured into a cluster. You must first create the instances from the prepared image and then attach the data disks.
When creating the instances, you can use the following two methods of authentication to access the instance.
  • Authenticate using SSH keys
  • Authenticate using password
  1. Create the Red Hat Gluster Storage VM.

    Note

    The vnic-name, public-ip-name, and public-ip-domain-name are created when you run this command. Enter the names you want to use, and they will be created when the command runs. Copy and paste the image URL from the previous step for the -Q option. The -G option generates ssh keys. Note the path to the key-pem file in the resulting displayed details. You need the path to this file to ssh in to your Azure VM.

    Important

    Microsoft Azure virtual machine names can contain letters, digits, a period, and a hyphen. The name cannot start or end with a hyphen, cannot be composed entirely of numbers, or be longer than 512 characters. Refer to Microsoft's Recommended naming conventions for Azure resources article for additional details https://docs.microsoft.com/en-us/azure/guidance/guidance-naming-conventions.
    Authenticate using SSH keys

    1. Enter the following command to create the Red Hat Gluster Storage instance and authenticate using SSH keys
       azure vm create -g [resource-group] -l [azure-region] -f [vnic-name] -y [os-type] -Q [image-url] -G -z [vm-size] -i [public-ip-name] -o [storage-account-name] -R [storage-container-name] -m [public-ip-allocation-method] -w [public-ip-domain-name] -t [public-ip-idletimeout] -F [vnet-name] -j [vnet-subnet-name] -u [admin-name] -n [virtual-machine-name]
      For example,
      # azure vm create -g rhgsarm -l eastus -f rhgsimage72vnic -y Linux -Q https://rhgsstorage.blob.core.windows.net:443/rhgscontainer/rhgsimage72.vhd -G -z Standard_A2 -i rhgs72_pub -o rhgsstorage -R rhgscontainer -m dynamic -w rhgs72 -t 10 -F rhgsvnet1 -j rhgssubnet1 -u clouduser -n rhgs72
      info:    Executing command vm create
      + Looking up the VM "rhgs72"
      info:    You can use /root/.azure/ssh/rhgs72-key.pem private key for SSH authentication.
      info:    Verifying the public key SSH file: /root/.azure/ssh/rhgs72-cert.pem
      info:    Using the VM Size "Standard_A2"
      info:    The [OS, Data] Disk or image configuration requires storage account
      + Looking up the storage account rhgsstorage                             info:    Using "https://rhgsstorage.blob.core.windows.net:443/rhgscontainer/rhgsimage72.vhd" as the user image.
      + Looking up the NIC "rhgsimage72vnic"                                   info:    Found an existing NIC "rhgsimage"
      info:    Found an IP configuration with virtual network subnet id "/subscriptions/2586c64b-38b4-4527-a140-012d49dfc02c/resourceGroups/rhgsarm/providers/Microsoft.Network/virtualNetworks/rhgsvnet1/subnets/rhgssubnet1" in the NIC "rhgsimage72vnic"
      info:    This NIC IP configuration is already configured with the provided public ip "rhgs72_pub"
      info:    The storage URI 'https://rhgsstorage.blob.core.windows.net/' will be used for boot diagnostics settings, and it can be overwritten by the parameter input of '--boot-diagnostics-storage-uri'.
      + Creating VM "rhgs72"
      info:    vm create command OK
    2. Start an SSH session and connect to the running VM using your administrator name and the public key file.
      # ssh -i [path-to-key-pem] [admin-name@public-ip-address]
      For example,
      # ssh -i /root/.azure/ssh/rhgs72-key.pem clouduser@rhgs72.east.cloudapp.azure.com
    Authenticate using password

    1. Enter the following command to create the Red Hat Gluster Storage instance and authenticate using password. You must enter the password when prompted.
      # azure vm create -g [resource-group] -l [azure-region] -f [vnic-name] -y [os-type] -Q [image-url] -z [vm-size] -i [public-ip-name] -o [storage-account-name] -R [storage-container-name] -m [public-ip-allocation-method] -w [public-ip-domain-name] -t [public-ip-idletimeout] -F [vnet-name] -j [vnet-
      subnet-name] -u [admin-name] -n [virtual-machine-name]
      For example,
      # azure vm create -g rhgsarm732 -l eastus -f rhgs732vnic -y Linux -Q https://rhgsstorage732.blob.core.windows.net/rhgscontainer732/rhgsimage732.vhd -z Standard_A2 -i rhgs732_pub -o rhgsstorage732 -R rhgscontainer732 -m dynamic -w rhgs7322 -t 10 -F rhgsvnet732 -j rhgssubnet732 -u clouduser -n rhgs732-2
      info: Executing command vm create
      + Looking up the VM "rhgs732-2"
      Enter password for clouduser: **********
      Confirm password: **********
      info: Using the VM Size "Standard_A2"
      info: The [OS, Data] Disk or image configuration requires storage account
      + Looking up the storage account rhgsstorage732
      info: Using "https://rhgsstorage732.blob.core.windows.net/rhgscontainer732/rhgsimage732.vhd" as the user image.
      + Looking up the NIC "rhgs732vnic"
      info: Found an existing NIC "rhgs732vnic"
      info: Found an IP configuration with virtual network subnet id "/subscriptions/2586c64b-38b4-4527-a140-012d49dfc02c/resourceGroups/rhgsarm732/providers/Microsoft.Network/virtualNetworks/rhgsvnet732/subnets/rhgssubnet732" in the NIC "rhgs732vnic"
      info: This NIC IP configuration is already configured with the provided public ip "rhgs732_pub"
      info: The storage URI 'https://rhgsstorage732.blob.core.windows.net/' will be used for boot diagnostics settings, and it can be overwritten by the parameter input of '--boot-diagnostics-storage-uri'.
      +i reating VM "rhgs732-2"
      info: vm create command OK
    2. Start an SSH session and connect to the running VM using your administrator name and the password used while creating the instance.
      # ssh [admin-name@public-ip-address]
      For example,
      # ssh clouduser@rhgs72.east.cloudapp.azure.com
  2. Add a data disk to your newly created virtual machine.
    # azure vm disk attach-new resource-group vm-name size-in-gb
    For example,
    # azure vm disk attach-new rhgsarm rhgs72 1023
    info:    Executing command vm disk attach-new
    + Looking up the VM "rhgs72"
    info:    New data disk location: https://rhgsstorage.blob.core.windows.net/rhgscontainer/rhgs72-20170220-121452858.vhd
    + Updating VM "rhgs72"
     info:    vm disk attach-new command OK
  3. Perform the above steps of creating instances and attaching disks for all the instances.
  4. Confirm that the instances have been properly created:
    # azure vm list -g [resource group]
    For example,
     # azure vm list rhgsarm
    info:    Executing command vm list
    + Getting virtual machines
    data:    ResourceGroupName  Name      ProvisioningState  PowerState      Location  Size
    data:    -----------------  --------  -----------------  --------------  --------  -----------
    data:    rhgsarm            rhgs72    Succeeded          VM deallocated  eastus    Standard_A2
    data:    rhgsarm            rhgs72-1  Succeeded          VM deallocated  eastus    Standard_A2
    info:    vm list command OK
    
    # azure vm show -g rhgsarm rhgs72
    info:    Executing command vm show
    + Looking up the VM "rhgs72"
    + Looking up the NIC "rhgsimage72vnic"
    + Looking up the public ip "rhgs72_pub"
    Id                              :/subscriptions/2586c64b-38b4-4527-a140-012d49dfc02c/resourceGroups/rhgsarm/providers/Microsoft.Compute/virtualMachines/rhgs72data:    ProvisioningState               :Succeeded
    data:    Name                            :rhgs72
    data:    Location                        :eastus
    data:    Type                            :Microsoft.Compute/virtualMachines data:
    data:    Hardware Profile:
    data:      Size                          :Standard_A2
     data:
    data:    Storage Profile:
    data:
    data:      OS Disk:
    data:        OSType                      :Linux
    data:        Name               :clib438d5640249ac7c-os-1486533879443
    data:        Caching                     :ReadWrite
    data:        CreateOption                :FromImage
    data:        Vhd:
    data:          Uri                       :https://rhgsstorage.blob.core.windows.net/rhgscontainer/clib438d5640249ac7c-os-1486533879443.vhd
    data:
    data:    OS Profile:
    data:      Computer Name                 :rhgs72
    data:      User Name                     :clouduser
    data:      Secrets                       :[]
    data:      Linux Configuration:
    data:        Disable Password Auth       :true
    data:
    data:    Network Profile:
    data:      Network Interfaces:
    data:        Network Interface #1:
    data:          Primary                   :true
    data:          MAC Address               :00-0D-3A-13-36-A0
    data:          Provisioning State        :Succeeded
    data:          Name                      :rhgsimage72vnic
    data:          Location                  :eastus
    data:            Public IP address       :40.121.209.95
    data:            FQDN              :rhgs72.eastus.cloudapp.azure.com
    data:
    data:    Diagnostics Profile:
    data:      BootDiagnostics Enabled       :true
    data:      BootDiagnostics StorageUri:https://rhgsstorage.blob.core.windows.net/
    data:
    data:      Diagnostics Instance View:
    info:    vm show command OK
  • A Microsoft Azure availability set provides a level of fault tolerance to the instances it holds, protecting against system failure or planned outages. This is achieved by ensuring instances within the same availability set are deployed across the different fault and upgrade domains within a Microsoft Azure datacenter.
  • When Gluster Storage replicates data between bricks, associate the replica sets to a specific availability set. By using availability sets in the replication design, incidents within the Microsoft Azure infrastructure cannot affect all members of a replica set simultaneously.