> How can my hosts self organize into different groups?
In cfengine 3 select_class
can be used for partitioning hosts into separate
groups without central coordination. Given the same list of options in the same
order each host will always choose the same option.
|
|
This can be useful to automatically partition a group of hosts. This can be useful for simple load balancing or staggering things like automatic patching.
The distribution is not perfect by any means. The distribution is based on a hash of each hosts fqdn and the hosts primary ip. It's a good idea to take a look at your selection distribution to make sure it's adequate for your environment.
Let's see the distribution as we go from two to seven options with 15 hosts.
With two options 11 of the hosts select the first option and only four hosts select the second option.
<img src="" alt="" width="100%"/>
With three options six hosts select the first option, two select the second and seven select the third.
<img src="" alt="" width="100%"/>
With four options six hosts select option one, one host selects option two, three hosts select option three, and five hosts select option four.
<img src="" alt="" width="100%"/>
With five options six hosts select option one, one host selected option two, one host selected option three, two hosts selected option four and five hosts select option five.
<img src="" alt="" width="100%"/>
With six options five hosts select option one, one host selected option two, one host selected option three, one hosts selected option four, five hosts select option five, and two hosts select option six.
<img src="" alt="" width="100%"/>
With seven options to choose from four hosts select option one, one host selected option two, one host selected option three, one hosts selected option four, four hosts select option five, zero hosts select option six, and four hosts select option seven.
<img src="" alt="" width="100%"/>