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 task, but configure connection criteria instead of request criteria. These connection criteria identify clients that could be impacted by replication latency. These clients 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:

  1. Create the new failover load-balancing algorithm using dsconfig with the create-load-balancing-algorithm option.
    Note:

    The failover load-balancing algorithm should list the same set of servers as the existing fewest operation load-balancing algorithm.

    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
    
  2. To route operations from a single client to a single server in a set of replicated servers, create connection criteria using dsconfig with the create-connection-criteria option.
    dsconfig create-connection-criteria \
      --criteria-name "Client One"  --type simple \
      --set included-user-base-dn:cn=Client One,ou=Apps,dc=example,dc=com
    
  3. Configure a criteria-based load balancing algorithm and assign it to the proxying request processor, usingdsconfig with the create-criteria-based-load-balancing-algorithm option.

    Use the load balancing algorithm and connection criteria created in steps 1-2.

    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"
    
  4. Assign the new criteria-based load balancing algorithm to the proxying request processor using dsconfig with the set-request-processor-prop option.
    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