To create a type of server affinity, where all operations from a single client are routed to a specific set of servers, follow a similar process as in the previous use case. Instead of request criteria, configure connection criteria. These connection criteria identify clients that could be adversely affected by replication latency. These clients will use the Failover Load Balancing Algorithm rather than the default Fewest Operations Load Balancing Algorithm.
For example, an administrative tool includes a "delete user" function. If the application immediately re-queries the directory for an updated list of users, the just-deleted entry must not be included. To configure a criteria-based load balancing algorithm to support this use case, perform the following:
- Create a failover load balancing algorithm that lists the same set of servers as the existing fewest operation load balancing algorithm.
- Create connection criteria that match the clients for which failover load balancing should be applied, rather than fewest operations load balancing.
- Create a criteria-based load balancing algorithm that references the two configuration objects created in the previous steps.
- Assign the new load balancing algorithm to the proxying request processor.
The following procedure provides examples of each of these steps.
Create the new failover load balancing algorithm using
dsconfig as follows:
dsconfig create-load-balancing-algorithm \ --algorithm-name client_one_routing_algorithm \ --type failover --set enabled:true \ --set backend-server:east1.example.com:389 \ --set backend-server:east2.example.com:389
To route operations from a single client to a single server in a set of replicated servers,
create connection criteria using dsconfig as follows:
dsconfig create-connection-criteria \ --criteria-name "Client One" --type simple \ --set included-user-base-dn:cn=Client One,ou=Apps,dc=example,dc=com
Configure a criteria-based load balancing algorithm and assign it to the proxying request processor.
Use the load balancing algorithm and connection criteria created in the previous steps:
dsconfig create-criteria-based-load-balancing-algorithm \ --algorithm-name dc_example_dc_com-client-operations \ --set load-balancing-algorithm:dc_example_dc_com-failover \ --set "request-criteria:Client One Requests"
Assign the new criteria-based load balancing algorithm to the proxying request processor using dsconfig as follows:
dsconfig set-request-processor-prop \ --processor-name dc_example_dc_com-req-processor \ --add criteria-based-load-balancing-agorithm:dc_example_dc_com-client-operations