Team Leader - Nutanix Technology Champion - Nutanix NTC Storyteller

Julien DUMUR
Infrastructure in a Nutshell

For a customer case, I had to configure the anti-affinity between 2 virtual machines.

Anti-affinity: what is it?

First, I’ll give some context so the foundations are laid. For one of our clients, I am deploying 2 Palo Alto virtual machines to set up a cluster which will manage flows between its different networks.

In order to ensure maximum redundancy in the event of any failure, it is essential that the virtual machines be hosted on different hosts. Indeed, if they were hosted on a single host, in the event of a host failure, the Palo Alto cluster would be out of service.

This is where anti-affinity comes into play and will allow me to ensure that the 2 virtual machines are never found on the same host.

Setting up anti-affinity

The implementation of the anti-affinity is to be carried out in command lines directly from one of the CVMs of the cluster and takes place in several stages:

  • Create a group: connect via SSH then type the following command:
nutanix@cvm$ acli vm_group.create group_name
  • Add the virtual machines to the group:
nutanix@cvm$ acli vm_group.add_vms group_name vm_list=vm_name1,vm_name2
  • Enable anti-affinity:
nutanix@cvm$ acli vm_group.antiaffinity_set group_name

After a while, virtual machines that were previously on the same host will then be spread across 2 different hosts.

In the event of failure of a host hosting one of the 2 virtual machines, the machine concerned will be restarted on one of the hosts in compliance with the anti-affinity rule.

Be careful, however, if you manually migrate a virtual machine or as part of the host being put under maintenance, the anti-affinity rule may not apply.

Official documentation

The official Nutanix documentation: https://portal.nutanix.com/page/documents/details?targetId=AHV-Admin-Guide-v6_7:ahv-vm-anti-affinity-t.html

0 comments

Leave a Reply