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
Just because software passes functional tests doesn't mean it works. Dig into stress, load, endurance and other performance tests, and their ... Continue Reading
Don't neglect form factor as part of your data center server selection. Instead, figure out what type of environment you need and learn which server ... Continue Reading
Learn how load balancing in the cloud differs from a traditional network traffic distribution, and explore the different services available from AWS,... Continue Reading