Search the VMware Knowledge Base (KB)
View by Article ID

Using Oracle RAC on a vSphere 6.x vSAN Datastore (2121181)

  • 5 Ratings
Language Editions

Purpose

As occurs with VMFS and NFS datastores, VMware vSAN prevents multiple virtual machiness from opening the same virtual disk (VMDK) in read-write mode. This is to protect the data stored on the virtual disk from corruption caused by multiple writers on the non-cluster-aware filesystems used by most guest OSes.

To enable in-guest systems that leverage cluster-aware filesystems that have distributed write (multi-writer) capability, we must explicitly enable multi-writer support for all applicable virtual machines and VMDKs.

This article outlines the process to create shareable VMDKs that reside on VMware vSAN and to enable multi-writer mode. This will permit multiple VMs to access the same VMDKs in read-write mode to enable the use of in-guest shared-storage clustering solutions such as Oracle RAC.


Warning: Do not enable multi-writer mode for any VM/VMDK combination unless the guests are capable of safely arbitrating and coordinating multiple systems accessing the same storage. Enabling multi-writer mode for disks that do not use in-guest cluster-aware filesystems will result in data corruption.

Note: Enabling multi-writer mode removes support for some virtual machine operations and vSphere features. Please refer to this matrix for operation/feature supportability when multi-writer mode is enabled:

Supported and unsupported actions or features

Actions or Features

Supported

Unsupported

Notes

Power on, off, restart virtual machine


 

Suspend VM


×


Hot add virtual disks


Only to existing adapters

Hot remove devices



Hot extend virtual disk


×


Connect and disconnect devices



Snapshots


×

Virtual backup solutions leverage snapshots through the vStorage APIs; for example, VMware Data Recovery, vSphere Data Protection. These are also not supported.

Snapshots of VMs with independent-persistent disks


Only the shared disks need to be in independent-persistent mode

Cloning


×


Storage vMotion


×


Changed Block Tracking (CBT)


×


vSphere Flash Read Cache (vFRC)


×

Stale writes can lead to data loss and/or corruption

vMotion
       


       


       

Supported for ORAC only and limited to 8 ESX/ESXi hosts
   


Physical Use case:

vSAN 6.5 and later provides support for vSAN iSCSI Targets feature that presents vSAN based storage as iSCSI LUNs to iSCSI initiators.
If iSCSI initiators are configured in Oracle RAC physical machines, they can share iSCSI LUNs presented from vSAN 6.5 and later.

Refer vSAN 6.5 documentation for instructions on configuring vSAN iSCSI Targets.

Using this configuration does not require special considerations on the physical machines. Thus the rest of this article does not apply.

Virtual Use case:

  • Oracle RAC, in which the application ensures that writes originating from two or more different virtual machines do not cause data loss
  • This configuration was tested and supported on vSphere 6.x only.

Limitations and Requirements:


Note:

8 hosts limit applies to multi-writer mode shared virtual disks only. Otherwise, vSphere cluster size can be up to the maximum size supported by the license in use.

Resolution

Overview

The process of configuring an Oracle RAC cluster on a vSAN datastore needs to be done once per RAC cluster at creation time. This requires these steps:

  • Creating a VM Storage Policy that will be applied to the virtual disks that will be used as the cluster’s shared storage.
  • Creating the shared virtual disks in eager-zeroed mode.
    • The current version of vSphere Web Client lacks the required configuration options. This necessitates the use of CLI on relevant ESXi hosts in the vSAN Cluster or PowerCLI.
      Note: The use of PowerCLI reduces several steps and is recommended.
  • Attaching the shared disks to one or more VMs
  • Enabling multi-writer mode for the VMs and Disks using the ESXi command line.
    • The current version of vSphere Web Client lacks the required configuration options. This necessitates the use of CLI on relevant ESXi hosts.
  • Applying the VM Storage Policy to the shared disks.

Warning: All virtual machines that will be Oracle RAC nodes must be in powered off state before proceeding.

Create a VM Storage Policy

Depending on your Virtual Machine design specifications, you will need to define the VM Storage Policy that will be applied to the RAC shared disks. Create a storage policy similar to this figure:

Notes:

  • In this example we named the VM Storage Policy "RAC"
  • Object Space Reservation: 100% which pre-allocates all object’s components on disk.
  • Number of failures to tolerate: 1 is the default which will provide a mirror replica on another vSAN node. This provides RAID 1 protection against one host/hardware component failure. As the dialog shows, this will consume double the storage space on the vSAN datastore.
  • Number of disk stripes per object: The default vSAN policy is 1. For this policy select the desired stripe width. This is similar to RAID 0. In this example we are using the value of 2.

For more information about storage policy configuration options, please see the VMware vSAN documentation.


Add a storage controller to the Oracle RAC VMs

Note: Create controllers of the same type and in the same position (SCSI address) on each Oracle RAC virtual machine.

  1. Right-click the VM in the vSphere Web Client and select Edit Settings.
  2. At the bottom of the subsequent window, select SCSI Controller from the New device: drop-down menu and then click Add.
  3. Expand the New SCSI Controller entry.
  4. Leave the Bus Sharing mode as None, and choose the desired type (LSI Parallel or LSI SAS or Paravirtual).

    Note: The Paravirtual controller type is generally recommended for RAC shared disks.

  5. Click OK


  6. Repeat this process on the remaining RAC VMs.


Creating Eager-Zeroed Disks (PowerCLI)

In its current release, the vSphere Web Client cannot create eager-zeroed disks on the vSAN datastore. While the vSAN Datastore supports eager-zeroed disks, this functionality is not currently exposed in the vSphere Web Client. To accommodate this limitation in the current release, we must use either PowerCLI or the ESXi command line to create the eager-zeroed disks. This section outlines the PowerCLI method to create disks, and is the preferred method.
  1. Launch PowerCLI and connect to vCenter with Connect-VIServer.
    For more guidance with PowerCLI conventions, login, etc., please see the VMware vSphere PowerCLI Documentation.

  2. Create the new hard disk with the New-HardDisk cmdlet in the form of:

    New-HardDisk -VM VM_name -CapacityGB size -Datastore vSAN_datastore_name -StorageFormat EagerZeroedThick -Controller controller_name -Persistence IndependentPersistent

    For example, to create a 10GB disk on the RAC_0 VM, attached to SCSI Controller 1 on the datastore vsanDatastore, run this command:

    New-HardDisk -VM “RAC_0” -CapacityGB 10 -Datastore “vsanDatastore” -StorageFormat EagerZeroedThick -Controller “SCSI Controller 1” -Persistence IndependentPersistent

    The name of the storage controller will match the name of the device we added to the VMs in the previous section.

  3. Repeat this process for any remaining shared disks you wish to create.

Creating Eager-Zeroed Disks (ESXi command line)

You cannot create eager-zeroed disks on the vSAN datastore using the latest version of the vSphere Web Client . While the vSAN Datastore supports eager-zeroed disks, this functionality is not currently exposed in the vSphere Web Client. To accommodate this limitation in the current release, we must use either PowerCLI or the ESXi command line to create the eager-zeroed disks. This section outlines the ESXi command line method to create disks.

Note: You must enable the local ESXi shell or SSH access to the host and log in as privileged (root) user to complete the below procedure.
  1. Navigate to the directory of the first VM in the Oracle RAC cluster:

    cd /vmfs/volumes/vsan_datastore/VM_Name

    For example:

    cd /vmfs/volumes/vsanDatastore/RAC_0

  2. Create an Eager Zeroed Thick virtual disk to be shared using vmkfstools:

    vmkfstools -c size -W vsan -d eagerzeroedthick `pwd`/vmdk_ile_name

    For example:

    vmkfstools -c 12G –W vsan –d eagerzeroedthick `pwd`/RAC_0_1.vmdk
  3. Repeat step 2 for as many shared disks as need to be created.


Adding shared disks to one or more virtual machines

After the eager-zeroed disks are created, you must add them to the remaining RAC VMs using either the vSphere Web Client or PowerCLI.

Note: The virtual disks should be added to the same SCSI positions on each virtual machine. If a disk is in position 1:0 on one virtual machine, it should be in position 1:0 on all virtual machines in the RAC cluster.

Using the vSphere Web Client

To add shared disks to one or more virtual machines using the vSphere Web Client:
  1. Right-click the appropriate VM and select Edit Settings.
  2. Select Existing Hard Disk from the New Device drop-down menu and then click Add.
  3. Navigate to the applicable directory and select the disk.
  4. Click OK.
  5. Expand the New Hard Disk entry and modify the Virtual Device Node, as appropriate.
  6. In the Sharing dropdown menu, select the Multi-writer option.

    Note: This option is available only in the vSphere Web Client 6.0 Update 1 and later versions. For vSphere 6.0 GA (without any updates), you must edit the VMX file manually using the instructions in the Enabling multi-writer mode for the VMs and Disks using the ESXi shell section.

  7. Change the Disk Mode to Independent-Persistent.
  8. Click OK to save the changes.



  9. Repeat this process for the remaining virtual machines and shared disks.


Using PowerCLI

  1. Launch PowerCLI and connect to vCenter Server with Connect-VIServer

  2. Add the existing disk with the New-HardDisk cmdlet in the form of:

    New-HardDisk -VM VM_Name -DiskPath “[datastore_name] folder/disk_file” -Controller controller_name -Persistence IndependentPersistent

    For example, to add the disk RAC_0_1.vmdk on the datastore vsanDatastore in the folder RAC_0 to the VM RAC_1 and attach it to SCSI Controller 1, run this command:

    New-HardDisk -VM RAC_1 -DiskPath “[vsanDatastore] RAC_0/RAC_0_1.vmdk” -Controller “SCSI Controller 1” -Persistence IndependentPersistent

  3. Repeat this process for the remaining VMs and shared disks.

Enabling multi-writer mode for the VMs and Disks using the ESXi shell

The addition of the multi-writer flag is not possible via the vSphere Web Client version prior to 6.0 Update 1. If vSphere 6.0 Update 1 or newer is not installed, use the ESXi shell to enable multi-writer mode on the applicable virtual machines and disks.

Note: As this involves modifying and loading virtual machine configurations, it is recommended that all RAC virtual machines be registered to the same ESXi host for the purposes of making these changes so we don’t have to log in to multiple hosts. The VMs can be distributed throughout the vSphere cluster after making these changes.

  1. To enable SCSI bus sharing for a particular disks, run:
    echo ‘scsi<N>:<D>.sharing = “multi-writer”’ >> path_to_VMX_file

    For example, to enable multi-writer for SCSI device 1:0 for the VM RAC_0 on the datastore vsanDatastore, run this command:

    echo ‘scsi1:0.sharing = “multi-writer”’ >> /vmfs/volumes/vsanDatastore/RAC_0/RAC_0.vmx

  2. Complete step 2 for all applicable disks and VMs, modifying the SCSI position as appropriate. For example, to share four disks, add all of these entries to the applicable VMX files:

    scsi1:0.sharing = "multi-writer"
    scsi1:1.sharing = "multi-writer"
    scsi1:2.sharing = "multi-writer"
    scsi1:3.sharing = "multi-writer"

  3. Refresh the VM configuration to apply the changes.
    1. Identify the VMs to refresh using this command:

      vim-cmd vmsvc/getallvms |grep -i VM_name

      For example, to list all VMs with RAC in the name registered to the host, run this command:

      vim-cmd vmsvc/getallvms |grep -i RAC

      You see output with the VM registration that includes the VMID in the left-most column. The VMID is a simple integer number.
    2. Refresh the configuration:

      vim-cmd vmsvc/reload VMID

      For example, if the VMID of one of the RAC VMs is 24, run this command:

      vim-cmd vmsvc/reload 24

  4. Reload all applicable VMs.

Applying the VM Storage Policies to the shared disks

After the disks are created and added to all virtual machines, you must apply the storage policy created for the RAC shared disks. The policy must be applied to all applicable disks on all RAC virtual machines.

  1. In vSphere Web Client, right-click the VM and click Edit Settings.
  2. Expand the appropriate hard disk entry.
  3. Choose the desired VM storage policy from the dropdown list.
  4. Verify that the disk mode is Independent – Persistent.
  5. Click OK.


  6. Repeat this process for all applicable virtual machines and disks.

    Note
    : If you want to apply a different storage policy to the RAC shared disks at a later date, the policy change must be executed against all shared disks and on all virtual machines sharing that disk.

Additional Information

See Also

Update History

10/26/2016 - Updated screenshots with the new options to configure Multi-Writer lock mode in the vSphere Web Client. Added vSAN 6.1 and 6.2 to Products. 11/15/2016 - Added vSAN 6.5 to Products 01/23/2017 - Added Physical Use case for use by vSAN iSCSI Targets. 04/18/2017 - Added vSAN 6.6 to Products

Request a Product Feature

To request a new product feature or to provide feedback on a VMware product, please visit the Request a Product Feature page.

Feedback

  • 5 Ratings

Did this article help you?
This article resolved my issue.
This article did not resolve my issue.
This article helped but additional information was required to resolve my issue.

What can we do to improve this information? (4000 or fewer characters)




Please enter the Captcha code before clicking Submit.
  • 5 Ratings
Actions
KB: