Affinity and anti-affinity rules guide VM-host and VM-VM behaviors. Affinity rules force VM members of a Distributed...
Resource Scheduler group to run on either a host group or with a VM group; anti-affinity rules block the VM members of a DRS group from running on a particular host group or with a VM group. Proper use of these rules can enhance performance and strengthen resilience.
The two primary approaches to affinity and anti-affinity rules are to create VM-host rules or to create VM-VM rules.
In the first method, an administrator can create VM-host affinity or anti-affinity rules to specify whether or not the VMs a DRS group includes can be placed on the nodes involved in a specified host DRS group. The administrator must create the VM and host groups to which VM-host rules will apply.
To create VM-host rules, select the desired cluster in the vSphere Web Client, then click Manage > Settings > DRS Rules > Add. Enter a meaningful name for the new rule in the Create DRS Rule dialog box. Select Virtual Machines to Hosts from the Type drop-down menu. Now, select the VM DRS group to apply the new rule. Finally, choose an affinity type, such as Must run on hosts in group or Should run on hosts in group, or select an anti-affinity type, such as Must not run on hosts in group or Should not run on hosts in group. Click OK to save changes and implement the rule.
In the second method, an administrator can create VM-VM affinity or anti-affinity rules to specify whether specific VMs should run together on the same host or be separated onto different hosts. Just remember that using the High Availability (HA) Specify Failover Hosts feature in vSphere will ignore VM-VM rules because it's possible to specify multiple failover hosts.
The process to create VM-VM rules is very similar to that used for VM-host rules. Select the desired cluster in the vSphere Web Client, then click Manage > Settings > DRS Rules > Add. Enter a descriptive name for the new rule in the Create DRS Rule dialog box. Locate the Type drop-down menu, and choose Keep Virtual Machines Together (affinity) or Separate Virtual Machines (anti-affinity). Click Add, and select two or more VMs to apply the rule. Click OK to save changes and implement the rule.
Make removing a single point of failure affordable
Set up automatic failover to maintain availability
Take advantage of DRS and HA rules for consistent uptime
Dig Deeper on DRS and DPM
Related Q&A from Stephen J. Bigelow
Your power users will want to be the first in line to try out upcoming features through the Office 365 targeted release program. Set up early access ... Continue Reading
Many compatibility issues can arise when moving VMs to the public cloud. Watch out for compatibility problems with partitions, OSes and image formats... Continue Reading
To migrate a VM and its dependencies from a local data center to a public cloud, use the forklift method to prepare the VM for migration, deploy the ... Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.