DescriptionTo further reduce fault tolerance, running multiple instances serving your application/ service together with the load balancer feature provided from the virtual router in CloudStack, is recommended. In case you have multiple servers running your services, you can assign instances to an Affinity group in CloudStack. This keeps instances from the same Affinity group with rule "host anti-affinity" deployed on different hypervisors as much as possible. Should a host fail and your instance goes down, another instance on a different host serving the same content keeps working preventing your entire service from being unavailable.
Affinity groups can be attached to instances while creating the instance. You can change an Affinity group of an existing instance from the Instance Details tab. Make sure to stop the instance before changing the Affinity group.
Adding an Affinity Group
- From the left menu choose Compute > Affinity Groups, click Add new Affinity Group.
Provide a name, optionally the description and choose affinity type.
Affinity types Description host anti-affinity CloudStack deploys instances on different hypervisors as much as possible. host affinity CloudStack deploys instances on same hypervisor as much as possible.
Adding an existing Instance to an Affinity group
From the left menu choose Compute > Instances, click on the instance name.
- Stop the instance, by clicking on Stop instance from the top right options.
- Click on Change Affinity, from the top right options.
- Select the Affinity group and confirm by clicking OK.
- Make sure to start up your instance again.