Instances Anti-Affinity/Affinity
Multiple instances of the same service or application should be deployed in different availability zones to avoid service disruption in case of an infrastructure outage. When this isn't possible or isn't enough to guarantee your application availability you can use an anti-affinity schedule policy. An affinity policy is also available.
Create a server group
First you need to create a "server group". The server group will contain all the instances to which you want to apply an anti-affinity/affinity policy.
withpolicy
: Add a policy (‘affinity’ or ‘anti-affinity’, defaults to ‘affinity’)name
: New server group name
If you want all the instances to be hosted on different compute nodes, create a server group with an anti-affinity policy. Otherwise use an affinity policy.
You can see your server groups with:
Create an instance and apply a schedule policy
To add an instance to a server group, use the following extra option when creating a new instance.
Example:
$ openstack server create --image <image_uuid> --flavor <flavor_name> --hint group=<server_group_uuid> <new_instance_name>
Note
- You can only add an instance to a server group at instance creation time. Not afterwards!
- When using an affinity policy you are limited to the resources available in the compute node where the first instance was scheduled.
Other useful operations:
Display server group details
Delete a server group