Now, we configure the placement algorithm using a batch file. We want to place new entries added through the proxy via LDAP ADD operations into the least used dataset. We do this using an entry-count placement algorithm. To change the placement algorithm from round-robin to entry-count, we first create and enable an entry-count placement algorithm configuration object and then disable the existing round-robin placement algorithm. Our batch file, dsconfig.post-setup, contains the dsconfig commands required to create the entry-count placement algorithm and disable the old round-robin algorithm.

The batch file contains comments to explain each dsconfig command. Note that in this example, line wrapping is used for clarity. The dsconfig command requires that the full command be provided on a single line.

The batch file itself looks like the following:
root@austin-proxy1:more ../dsconfig.post-setup
           
# This dsconfig operation creates the entry-count placement
# algorithm with the default behavior of adding entries to the
# smallest backend dataset first.
           
dsconfig create-placement-algorithm
--processor-name ou_people_dc_example_dc_com-eb-req-processor
--algorithm-name entry-count --type entry-counter --set enabled:true
           
# Note that once the entry-count placement algorithm is created
# and enabled, we can disable the round-robin algorithm.
# Since an entry-balancing proxy must always have a placement
# algorithm, we add a second algorithm and then disable the
# original round-robin algorithm created during the setup
# procedure.
           
dsconfig set-placement-algorithm-prop
--processor-name ou_people_dc_example_dc_com-eb-req-processor
--algorithm-name round-robin --set enabled:false
          
# At this point, LDAP ADD operations will be forwarded to an external
# server representing the dataset with the least number of entries.
  • Run the dsconfig command using the batch file. Once the batch file has executed, a new entry-count placement algorithm, called entry-count, has been created, and the old round-robin placement algorithm, round-robin, has been disabled.
    root@austin-proxy1: bin/dsconfig --no-prompt \
    --bindDN "cn=directory manager" --bindPassword password \
    --port 389  --batch-file ../dsconfig.post-setup
    Batch file '../dsconfig.post-setup' contains 2 commands
               
    Executing: create-placement-algorithm --no-prompt
    --bindDN "cn=directory manager" --bindPassword pass
    --port 1389
    --processor-name ou_people_dc_example_dc_com-eb-req-processor
    --algorithm-name entry-count --type entry-counter --set enabled:true
        
    Executing: delete-placement-algorithm --no-prompt
    --bindDN "cn=directory manager" --bindPassword pass
    --port 1389
    --processor-name ou_people_dc_example_dc_com-eb-req-processor
    --algorithm-name round-robin --set enabled:false