The following example shows how to extend a Directory Proxy Server's configuration to use a Criteria Based Load Balancing Algorithm to route all write requests to a single server using a Failover Load Balancing Algorithm. The approach outlined here can easily be extended to support alternate criteria as well as more complex topologies using multiple locations or Entry Balancing.

This example uses a simple deployment of a Directory Proxy Server fronting three Directory Servers: ds1.example.com, ds2.example.com, and ds3.example.com.

Once these configurations changes are applied, the Directory Proxy Server will route all write operations to ds1.example.com as long as it is available and then to ds2.example.com if it is not, while routing other types of operations, such as searches and binds, to all three servers using the Fewest Operations Load Balancing Algorithm.

  1. First, create a location.
    dsconfig create-location --location-name Austin
  2. Update the failover location for your server.
    dsconfig set-location-prop --location-name Austin
  3. Set the location as a global configuration property.
    dsconfig set-global-configuration-prop --set location:Austin
  4. Set up the health checks for each external server.
    dsconfig create-ldap-health-check \
    --check-name ds1.example.com:389_dc_example_dc_com-search-health-check \
    --type search --set enabled:true --set base-dn:dc=example,dc=com  
    
    dsconfig create-ldap-health-check \
    --check-name ds2.example.com:389_dc_example_dc_com-search-health-check \
    --type search --set enabled:true --set base-dn:dc=example,dc=com  
    
    dsconfig create-ldap-health-check \
    --check-name ds3.example.com:389_dc_example_dc_com-search-health-check \
    --type search --set enabled:true --set base-dn:dc=example,dc=com  
  5. Create the external servers.
    dsconfig create-external-server --server-name ds1.example.com:389 \
    --type Ping Identity-ds \
    --set server-host-name:ds1.example.com --set server-port:389 \
    --set location:Austin --set "bind-dn:cn=Proxy User,cn=Root DNs,cn=config" \
    --set password:AADoPkhx22qpiBQJ7T0X4wH7 \
    --set health-check:ds1.example.com:389_dc_example_dc_com-search-health-check    
    
    dsconfig create-external-server --server-name ds2.example.com:389 \
    --type Ping Identity-ds \
    --set server-host-name:ds2.example.com --set server-port:389 \
    --set location:Austin --set "bind-dn:cn=Proxy User,cn=Root DNs,cn=config" \
    --set password:AAAoVqVYsEavey80T0QfR60I \
    --set health-check:ds2.example.com:389_dc_example_dc_com-search-health-check    
    
    dsconfig create-external-server --server-name ds3.example.com:389 \
    --type Ping Identity-ds \
    --set server-host-name:ds3.example.com --set server-port:389 \
    --set location:Austin --set "bind-dn:cn=Proxy User,cn=Root DNs,cn=config" \
    --set password:AADOkveb0TtYR9xpkVrNgMtF \
    --set health-check:ds3.example.com:389_dc_example_dc_com-search-health-check  
  6. Create a Load Balancing Algorithm for dc=example,dc=com.
    dsconfig create-load-balancing-algorithm \
    --algorithm-name dc_example_dc_com-fewest-operations \
    --type fewest-operations --set  enabled:true \
    --set backend-server:ds1.example.com:389 \
    --set backend-server:ds2.example.com:389 \
    --set backend-server:ds3.example.com:389  
  7. Create a Request Processor for dc=example,dc=com.
    dsconfig create-request-processor \
    --processor-name dc_example_dc_com-req-processor \
    --type proxying \
    --set load-balancing-algorithm:dc_example_dc_com-fewest-operations  
  8. Create a Subtree View for dc=example,dc=com.
    dsconfig create-subtree-view \
    --view-name dc_example_dc_com-view \
    --set base-dn:dc=example,dc=com \
    --set request-processor:dc_example_dc_com-req-processor  
  9. Update the client connection policy for dc=example,dc=com.
    dsconfig set-client-connection-policy-prop \
    --policy-name default \
    --add subtree-view:dc_example_dc_com-view  
  10. Create a new Request Criteria object to match all write operations.
    dsconfig create-request-criteria \
    --criteria-name any-write \
    --type simple --set "description:All Write Operations" \
    --set operation-type:add --set operation-type:delete \
    --set operation-type:modify --set operation-type:modify-dn  
  11. Create a new Failover Load Balancing Algorithm listing the servers that should be included.  Note the order that the servers are listed here is the failover order between servers.
    dsconfig create-load-balancing-algorithm \
    --algorithm-name dc_example_dc_com-failover \
    --type failover --set enabled:true \
    --set backend-server:ds1.example.com:389 \
    --set backend-server:ds2.example.com:389 \
    --set backend-server:ds3.example.com:389  
  12. Tie the Request Criteria and the Failover Load Balancing Algorithm together into a Criteria Based Load Balancing Algorithm.
    dsconfig create-criteria-based-load-balancing-algorithm \
    --algorithm-name dc_example_dc_com-write-traffic-lba \
    --set "description:Failover LBA For All Write Traffic" \
    --set request-criteria:any-write \
    --set load-balancing-algorithm:dc_example_dc_com-failover  
  13. Update the Proxying Request Processor to use the Criteria Based Load Balancing Algorithm.
    dsconfig set-request-processor-prop \
    --processor-name dc_example_dc_com-req-processor \
    --set criteria-based-load-balancing-algorithm:dc_example_dc_com-write-traffic-lba