The steps to configure Preference Order algorithm through CLI mode are discussed in this section.
To use this algorithm, you must assign the preference order to each pool member. Once preference order is assigned, the Avi Load Balancer directs the traffic to the first available member in the ordered list specified by user as per the preference order.
The lower the preference order, higher is the preference and so the DNS Service chooses an operationally up member with the lowest preference.
Configuring Preference Order Algorithm to Add Priority to GSLB Pools
Set the GSLB service pool algorithm to gslb_algorithm_preference_order.
[admin:ctrl]: > configure gslbservice GS-1 Updating an existing object. Currently, the object is: +----------------------------------+--------------------------------------------------+ | Field | Value | +----------------------------------+--------------------------------------------------+ | uuid | gslbservice-88ad049f-e188-40f3-90de-235c6cb676a2 | | name | GS-1 | | domain_names[1] | foo.avi.com | | groups[1] | | | name | GS-1-pool | | priority | 9 | | algorithm | GSLB_ALGORITHM_ROUND_ROBIN | | members[1] | | | ip | 10.10.10.1 | | ratio | 1 | | enabled | True | | resolve_fqdn_to_v6 | False | | preference_order | 1 | | members[2] | | | ip | 10.10.10.2 | | ratio | 1 | | enabled | True | | resolve_fqdn_to_v6 | False | | preference_order | 1 | | enabled | True | | down_response | | | type | GSLB_SERVICE_DOWN_RESPONSE_NONE | | controller_health_status_enabled | True | | health_monitor_scope | GSLB_SERVICE_HEALTH_MONITOR_ALL_MEMBERS | | enabled | True | | use_edns_client_subnet | True | | wildcard_match | False | | site_persistence_enabled | False | | pool_algorithm | GSLB_SERVICE_ALGORITHM_PRIORITY | | min_members | 0 | | resolve_cname | False | | is_federated | True | | tenant_ref | admin | +----------------------------------+--------------------------------------------------+ [admin:ctrl]: gslbservice> groups index 1 [admin:ctrl]: gslbservice:groups> algorithm gslb_algorithm_preference_order Overwriting the previously entered value for algorithm
Configure preference_order value at GSLB service pool member level.
[admin:ctrl]: gslbservice:groups> members index 1 [admin:ctrl]: gslbservice:groups:members> preference_order 2 Overwriting the previously entered value for preference_order [admin:ctrl]: gslbservice:groups:members> save [admin:ctrl]: gslbservice:groups> members index 2 [admin:ctrl]: gslbservice:groups:members> preference_order 4 Overwriting the previously entered value for preference_order [admin:ctrl]: gslbservice:groups:members> save save[admin:ctrl]: gslbservice:groups> save [admin:ctrl]: gslbservice> save
The overall configuration is as shown below.
+----------------------------------+--------------------------------------------------+ | Field | Value | +----------------------------------+--------------------------------------------------+ | uuid | gslbservice-88ad049f-e188-40f3-90de-235c6cb676a2 | | name | GS-1 | | domain_names[1] | foo.avi.com | | groups[1] | | | name | GS-1-pool | | priority | 9 | | algorithm | GSLB_ALGORITHM_PREFERENCE_ORDER | | members[1] | | | ip | 10.10.10.1 | | ratio | 1 | | enabled | True | | resolve_fqdn_to_v6 | False | | preference_order | 2 | | members[2] | | | ip | 10.10.10.2 | | ratio | 1 | | enabled | True | | resolve_fqdn_to_v6 | False | | preference_order | 4 | | enabled | True | | down_response | | | type | GSLB_SERVICE_DOWN_RESPONSE_NONE | | controller_health_status_enabled | True | | health_monitor_scope | GSLB_SERVICE_HEALTH_MONITOR_ALL_MEMBERS | | enabled | True | | use_edns_client_subnet | True | | wildcard_match | False | | site_persistence_enabled | False | | pool_algorithm | GSLB_SERVICE_ALGORITHM_PRIORITY | | min_members | 0 | | resolve_cname | False | | is_federated | True | | tenant_ref | admin | +----------------------------------+--------------------------------------------------+ [admin:ctrl]: >
Note:
Preference order algorithm is supported only through CLI.