Skip Headers
Oracle® Fusion Middleware Administrator's Guide for Oracle Unified Directory
11g Release 2 (11.1.2)

Part Number E22648-05
Go to Documentation Home
Home
Go to Table of Contents
Contents
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

16 Example Proxy Configurations

This chapter illustrates how to configure specific proxy deployments by using the dsconfig command. You can also perform the configuration in interactive mode. For information, see Section 14.1.2, "Using dsconfig in Interactive Mode."

This chapter includes the following examples:

16.1 Configuring Load Balancing

The following is a step by step procedure that defines all the different elements needed to set up a deployment using simple load balancing. The following example describes load balancing with failover on two LDAP servers. For more information on the different types of load balancing available, see Section 11.1, "Load Balancing Using the Proxy."

The following figure illustrates the objects that must be created to configure a proxy server for simple load balancing. The objects must be created in the order indicated.

Figure 16-1 Load Balancing

Description of Figure 16-1 follows
Description of "Figure 16-1 Load Balancing"

All the commands in this procedure specify the proxy hostname (-h), the proxy admin port (-p), the bind DN for the initial root user (-D) and the file containing the proxy password (-j). You must also indicate the authentication; if none is indicated and the client and the server are running in the same instance, the local authentication configuration is used.

16.1.1 To Configure Simple Load Balancing

  1. Create a proxy LDAP server extension.

    $ dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file \
    create-extension \
    --extension-name proxy_extension1 \
    --type ldap-server \
    --set enabled:true \
    --set remote-ldap-server-address:DS1_hostname \
    --set remote-ldap-server-port:2389
    

    The LDAP server extension is a link to the remote LDAP server. For this use case, you will need at least two remote LDAP server instances. Go through this step again, making sure to use a different LDAP hostname and port.

  2. Create a proxy workflow element for each LDAP server extension.

    $ dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file \
    create-workflow-element \
    --element-name proxy-we1 \
    --type proxy-ldap\ 
    --set enabled:true \
    --set client-cred-mode:use-client-identity \
    --set ldap-server-extension:proxy_extension1
    

    The property client-cred-mode indicates the type of authentication used between the proxy and remote LDAP server. The client credential mode can be: use-client-identity or use-specific-identity.

  3. Create a load balancing workflow element.

    $ dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file \
    create-workflow-element \
    --element-name LB-we1 \
    --type load-balancing \
    --set enabled:true
    

    You only need one load balancing workflow element to route requests to either of the two remote LDAP servers.

  4. Define the load balancing algorithm.

    $ dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file \
    create-load-balancing-algorithm \
    --element-name LB-we1 \
    --type failover
    

    The type of load balancing algorithm can be proportional, saturation, optimal, searchfilter or failover. The properties of the load balancing algorithm (weight, threshold, or priority) are defined with the load balancing routes, in the next step.

  5. Define the load balancing routes for each proxy.

    $ dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file \
    create-load-balancing-route \
    --element-name LB-we1 \
    --route-name LB-route1 \
    --type failover \
    --set workflow-element:proxy-we1 \
    --set add-priority:1 \
    --set bind-priority:2 \
    --set compare-priority:2 \
    --set delete-priority:1 \
    --set extended-priority:2 \
    --set modify-priority:1 \
    --set modifydn-priority:1 \
    --set search-priority:2 
    

    Make sure that you specify the same type when defining the routes as you did when defining the load balancing algorithm.

    For this use case, you will need two load balancing routes. Go through this step again, specifying a different priority for each route.

    The properties in the example above set the priority for failover load balancing. If you use proportional or saturation load balancing, the properties will differ. For more information on the setting different load balancing types, see Section 15.1.3.5, "Modifying Load Balancing Properties."

  6. Create a workflow.

    This workflow associates the load balancing workflow element with the specified base dn.

    $ dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file \
    create-workflow \
    --workflow-name LB-workflow1 \
    --set enabled:true \
    --set base-dn:dc=example,dc=com \
    --set workflow-element:LB-we1 
    
  7. Create the network group.

    The network group handles all the requests between the client and the proxy.

    $ dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file \
    create-network-group \
    --group-name network-group1 \
    --set enabled:true \
    --set workflow:LB-workflow1 \
    --set priority:1
    

16.2 Configuring Distribution

The following procedure describes the elements that are required to set up a simple distribution deployment. The example shows distribution split over two partitions. For information about the supported distribution types, see Section 11.2, "Data Distribution Using the Proxy."

The following figure illustrates the objects that must be created to configure a proxy server for simple distribution. The objects must be created in the order indicated.

Figure 16-2 Configuring Distribution

Description of Figure 16-2 follows
Description of "Figure 16-2 Configuring Distribution"

All the commands in this procedure specify the proxy hostname (-h), the proxy admin port (-p), the bind DN for the initial root user (-D) and the proxy password you want to configure (-w). You must also indicate the authentication; if none is indicated and the client and the server are running in the same instance, the local authentication configuration is used.

16.2.1 To Configure Simple Distribution

  1. Create a proxy LDAP server extension.

    $ dsconfig -h localhost -p 4444 -D "cn=Directory Manager" -j pwd-file -X \
    create-extension \
    --extension-name proxy_extension1 \
    --type ldap-server \
    --set enabled:true \
    --set remote-ldap-server-address:DS1_hostname \
    --set remote-ldap-server-port:2389
    

    The LDAP server extension is a link to the remote LDAP server. For this use case, you will need two remote LDAP server instances. Go through this step again, making sure to use a different LDAP hostname and port.

  2. Create a proxy workflow element for each LDAP server extension.

    $ dsconfig -h localhost -p 4444 -D "cn=Directory Manager" -j pwd-file -X \
    create-workflow-element \
    --element-name proxy-we1 \
    --type proxy-ldap\ 
    --set enabled:true \
    --set client-cred-mode:use-client-identity \
    --set ldap-server-extension:proxy_extension1
    

    You will need at least two remote LDAP servers for a distribution architecture. Go through this step again. The LDAP server extension name should be the same as those created in step 1.

    The property client-cred-mode indicates the type of authentication used between the proxy and remote LDAP server. The client credential mode can be: use-client-identity or use-specific-identity.

  3. Set up distribution by creating a distribution workflow element.

    $ dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file \
    create-workflow-element \
    --element-name distrib-we \
    --type distribution \ 
    --set base-dn:dc=example,dc=com \
    --set enabled:true 
    
  4. Set the distribution algorithm.

    $ dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file \
    create-distribution-algorithm \
    --element-name distrib-we \
    --type numeric \ 
    --set distribution-attribute:uid
    

    The type of distribution algorithm can be capacity, numeric, lexico, or dnpattern. The properties of the algorithm are defined when you create the distribution partitions, in the next step.

  5. Define the distribution partitions.

    $ dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file \
    create-distribution-partition \
    --element-name distrib-we \
    --partition-name distrib-part1\
    --type numeric \ 
    --set lower-bound:0 \
    --set upper-bound:1000 \
    --set partition-id:1 \
    --set workflow-element:proxy-we1
    

    For this use case, you will need to create two partitions. Make sure that the partition ID and the partition name are unique for each workflow element. You must specify the same type when defining the partitions as you did when defining the distribution algorithm.

    Note:

    The upper boundary indicated is exclusive. This means that if you indicate 1000 as the upper boundary, the partition will only include values from 0 to 999, inclusive.

    To create a global index

    Depending on the type of distribution algorithm defined, you need to create a global index. If you created a capacity algorithm, then you must create a global index.

    For lexico, numeric, and dnpattern, a global index is optional.

    Perform the following steps to create a global index:

    1. Create a global index catalog.

      $ gicadm -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file \
      create-catalog \
      --catalogName gi-catalog
      
    2. Add a global index which indexes the dn attribute to the catalog.

      $ gicadm -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file \
      add-index \
      --catalogName gi-catalog \
      --attributeName dn 
      
    3. Associate the global index catalog to the distribution.

      $ gicadm -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file \
      associate \
      --catalogName gi-catalog \
      --distributionWorkflowElement distrib-we
      
  6. Create a workflow.

    This workflow associates the distribution workflow element with the distribution partition.

    $ dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file \
    create-workflow \
    --workflow-name distrib-workflow \
    --set enabled:true \
    --set base-dn:dc=example,dc=com \
    --set workflow-element:distrib-we
    
  7. Create the network group.

    The network group handles all the requests between the client and the proxy.

    $ dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file \
    create-network-group \
    --group-name network-group1 \
    --set enabled:true \
    --set workflow:distrib-workflow \
    --set priority:1
    

16.3 Configuring Distribution and Load Balancing

This use case combines distribution with load balancing. As for all distribution deployments, you can add a global index, however, this is not included here. For information about creating a global index, see Section 15.1.7, "Configuring Global Indexes By Using the Command Line."

The following figure illustrates the objects that must be created to configure a proxy server for distribution with load balancing. The objects must be created in the order indicated.

Figure 16-3 Configuring Distribution and Load Balancing

Description of Figure 16-3 follows
Description of "Figure 16-3 Configuring Distribution and Load Balancing"

The following example presents a deployment with distribution over two partitions, with each partition load balanced onto two replicated LDAP servers. The distribution algorithm used to partition the data is numeric.

All the commands in this procedure specify the proxy hostname (-h), the proxy admin port (-p), the bind DN for the initial root user (-D) and the file containing the proxy password (-j). You must also indicate the authentication; if none is indicated and the client and the server are running in the same instance, the local authentication configuration is used.

16.3.1 To Configure Distribution with Load Balancing

  1. Create the proxy LDAP server extensions.

    $ dsconfig -h localhost -p 4444 -D "cn=Directory Manager" -j pwd-file -X \
    create-extension \
    --extension-name proxy_extension1 \
    --type ldap-server \
    --set enabled:true \
    --set remote-ldap-server-address:DS1_hostname \
    --set remote-ldap-server-port:2389
    

    The LDAP server extension is a link to the remote LDAP server. For this use case, you will need four remote LDAP server instances. Go through this step once for each remote LDAP server, making sure to use a different LDAP hostname and port.

  2. Create a proxy workflow element for each LDAP server extension.

    $ dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file \
    create-workflow-element \
    --element-name proxy-we1 \
    --type proxy-ldap\ 
    --set enabled:true \
    --set client-cred-mode:use-client-identity \
    --set ldap-server-extension:proxy_extension1
    

    For this use case, you will need four remote LDAP server instances. Go through this step once for each remote. The LDAP server extension name should be the same as those created in step 1.

    The property client-cred-mode indicates the type of authentication used between the proxy and remote LDAP server. The client credential mode can be: use-client-identity or use-specific-identity.

  3. Create a load balancing workflow element.

    $ dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file \
    create-workflow-element \
    --element-name LB-we1 \
    --type load-balancing \
    --set enabled:true
    

    You only need one load balancing workflow element to route requests to either of the two remote LDAP servers. In this use case, since you are using two load balancers, you will need to create two load balancing workflow elements.

  4. Define the load balancing algorithm.

    $ dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file \
    create-load-balancing-algorithm \
    --element-name LB-we1 \
    --type failover
    

    The type of load balancing algorithm can be proportional, optimal, saturation, searchfilter, or failover. The properties of the load balancing algorithm (weight, threshold, or priority) are defined with the load balancing routes, in the next step. For this use case, you will need two load balancing algorithms.

  5. Define the load balancing routes for each proxy.

    $ dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file \
    create-load-balancing-route \
    --element-name LB-we1 \
    --route-name LB-route1 \
    --type failover \
    --set workflow-element:proxy-we1 \
    --set add-priority:1 \
    --set bind-priority:1 \
    --set compare-priority:1 \
    --set delete-priority:1 \
    --set extended-priority:1 \
    --set modify-priority:1 \
    --set modifydn-priority:1 \
    --set search-priority:1 
    

    For this use case, you will need four load balancing routes. Set two routes per load balancing workflow element (created in the previous step); for example, one route with priority 1 for all operations and the other route with priority 2 for all operations.

    Note:

    The properties in the example above set the priority for failover load balancing. If you use proportional or saturation load balancing, the properties will differ. For more information on the setting different load balancing types, see Section 15.1.3.5, "Modifying Load Balancing Properties."

  6. Set up distribution by creating a distribution workflow element.

    $ dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file \
    create-workflow-element \
    --element-name distrib-we \
    --type distribution \ 
    --set base-dn:dc=example,dc=com \
    --set enabled:true 
    

    For this use case, you will need only one distribution workflow element, which will point to the distribution algorithm.

  7. Set the distribution algorithm.

    $ dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file \
    create-distribution-algorithm \
    --element-name distrib-we \
    --type numeric \ 
    --set distribution-attribute:uid
    

    The type of distribution algorithm can be capacity, numeric, lexico, or dnpattern. The boundaries are defined when you create the distribution partitions, in the next step.

  8. Define the distribution partitions.

    $ dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file \
    create-distribution-partition \
    --element-name distrib-we \
    --partition-name distrib-part1\
    --type numeric \ 
    --set lower-bound:0 \
    --set upper-bound:1000 \
    --set partition-id:1 \
    --set workflow-element:LB-we1
    

    For this use case, you will need to create two partitions. Make sure that the partition ID and the partition name are unique for each workflow element, and that each partition uses a different load balancing workflow element. You must specify the same type when defining the routes as you did when defining the load balancing algorithm.

    Note:

    The upper boundary indicated is exclusive. This means that if you indicate 1000 as the upper boundary, the partition will only include values from 0 to 999, inclusive.

    To create a global index

    Depending on the type of distribution algorithm defined, you need to create a global index. If you created a capacity algorithm, then you must create a global index.

    For lexico, numeric, and dnpattern, a global index is optional.

    Perform the following steps to create a global index.

    1. Create a global index catalog:

      $ gicadm -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file \
      create-catalog \
      --catalogName gi-catalog
      
    2. Add a global index which indexes the dn attribute to the catalog.

      $ gicadm -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file \
      add-index \
      --catalogName gi-catalog \
      --attributeName dn 
      
    3. Associate the global index catalog to the distribution.

      $ gicadm -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file \
      associate \
      --catalogName gi-catalog \
      --distributionWorkflowElement distrib-we
      
  9. Create a workflow.

    This workflow associates the distribution workflow element with the base DN.

    $ dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file \
    create-workflow \
    --workflow-name workflow \
    --set enabled:true \
    --set base-dn:dc=example,dc=com \
    --set workflow-element:distrib-we
    
  10. Create the network group.

    The network group handles all the requests between the client and the proxy.

    $ dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file \
    create-network-group \
    --group-name network-group1 \
    --set enabled:true \
    --set workflow:workflow \
    --set priority:1
    

16.4 Configuring Failover Between Data Centers

Use the following commands to set up a failover deployment between two data centers, as presented in Section 3.4, "Configuration 3: Failover Between Data Centers."

#Create a proxy LDAP extension for each remote LDAP server
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-extension \
  --type ldap-server \
  --extension-name proxy-extension1 \
  --set enabled:true \
  --set remote-ldap-server-address:DS1_hostname \
  --set remote-ldap-server-port:3189 

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-extension \
  --type ldap-server \
  --extension-name proxy-extension2 \
  --set enabled:true \
  --set remote-ldap-server-address:DS2_hostname \
  --set remote-ldap-server-port:3289 

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-extension \
  --type ldap-server \
  --extension-name proxy-extension3 \
  --set enabled:true \
  --set remote-ldap-server-address:DS3_hostname \
  --set remote-ldap-server-port:3389 

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-extension \
  --type ldap-server \
  --extension-name proxy-extension4 \
  --set enabled:true \
  --set remote-ldap-server-address:DS4_hostname \
  --set remote-ldap-server-port:3489 

#Create a proxy workflow element for each LDAP server extension
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-workflow-element \
  --element-name proxy-we1 \
  --type proxy-ldap \
  --set enabled:true \
  --set client-cred-mode:use-client-identity \
  --set ldap-server-extension:proxy-extension1 

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-workflow-element \
  --element-name proxy-we2 \
  --type proxy-ldap \
  --set enabled:true \
  --set client-cred-mode:use-client-identity \
  --set ldap-server-extension:proxy-extension2 

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-workflow-element \
  --element-name proxy-we3 \
  --type proxy-ldap \
  --set enabled:true \
  --set client-cred-mode:use-client-identity \
  --set ldap-server-extension:proxy-extension3 

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-workflow-element \
  --element-name proxy-we4 \
  --type proxy-ldap \
  --set enabled:true \
  --set client-cred-mode:use-client-identity \
  --set ldap-server-extension:proxy-extension4 

# Create a load balancing workflow element for each data center
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-workflow-element \
  --element-name LB-we1 \
  --type load-balancing \
  --set enabled:true 

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-workflow-element \
  --element-name LB-we2 \
  --type load-balancing \
  --set enabled:true 

# Define the load balancing algorithm for each data center
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-load-balancing-algorithm \
  --element-name LB-we1 \
  --type proportional 

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-load-balancing-algorithm \
  --element-name LB-we2 \
  --type proportional 

# Define the load balancing routes for each proxy 
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-load-balancing-route \
  --element-name LB-we1 \
  --route-name LB-route1 \
  --type proportional \
  --set workflow-element:proxy-we1 
 
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-load-balancing-route \
  --element-name LB-we1 \
  --route-name LB-route2 \
  --type proportional \
  --set workflow-element:proxy-we2 
 
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-load-balancing-route \
  --element-name LB-we2 \
  --route-name LB-route3 \
  --type proportional \
  --set workflow-element:proxy-we3 
 
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-load-balancing-route \
  --element-name LB-we2 \
  --route-name LB-route4 \
  --type proportional \
  --set workflow-element:proxy-we4 

# Set failover between the two data centers
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-workflow-element \
  --element-name FO-we \
  --type load-balancing \
  --set enabled:true 
  
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-load-balancing-algorithm \
  --element-name FO-we \
  --type failover 

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-load-balancing-route \
  --element-name FO-we \
  --route-name FO-route1 \
  --type failover \
  --set workflow-element:LB-we1 \
  --set add-priority:1 \
--set bind-priority:1 \
--set compare-priority:1 \
--set delete-priority:1 \
--set extended-priority:1 \
--set modify-priority:1 \
--set modifydn-priority:1 \
--set search-priority:1 \ 

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-load-balancing-route \
  --element-name FO-we \
  --route-name FO-route2 \
  --type failover \
  --set workflow-element:LB-we2 \
  --set add-priority:2 \
--set bind-priority:2 \
--set compare-priority:2 \
--set delete-priority:2 \
--set extended-priority:2 \
--set modify-priority:2 \
--set modifydn-priority:2 \
--set search-priority:2 \ 

# Create workflow
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-workflow \
  --workflow-name FO-workflow \
  --set enabled:true \
  --set base-dn:dc=example,dc=com \
  --set workflow-element:FO-we 

# Create network group
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-network-group \
  --group-name network-group1 \
  --set enabled:true \
  --set workflow:FO-workflow \
  --set priority:1

16.5 Configuring Distribution with Failover Between Data Centers

Use the following commands to set up a failover deployment between two data centers, as presented in Section 3.6, "Configuration 5: Distribution with Failover Between Data Centers."

#Create the first failover route
#Create a proxy LDAP extension for each remote LDAP server
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-extension \
  --type ldap-server \
  --extension-name proxy-extension-1a \
  --set enabled:true \
  --set remote-ldap-server-address:DS1a_hostname \
  --set remote-ldap-server-port:3189 

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-extension \
  --type ldap-server \
  --extension-name proxy-extension-2a \
  --set enabled:true \
  --set remote-ldap-server-address:DS2a_hostname \
  --set remote-ldap-server-port:3289 

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-extension \
  --type ldap-server \
  --extension-name proxy-extension-1b \
  --set enabled:true \
  --set remote-ldap-server-address:DS1b_hostname \
  --set remote-ldap-server-port:3389 

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-extension \
  --type ldap-server \
  --extension-name proxy-extension-2b \
  --set enabled:true \
  --set remote-ldap-server-address:DS2b_hostname \
  --set remote-ldap-server-port:3489 

#Create a proxy workflow element for each LDAP server extension
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-workflow-element \
  --element-name proxy-we-1a \
  --type proxy-ldap \
  --set enabled:true \
  --set client-cred-mode:use-client-identity \
  --set ldap-server-extension:proxy-extension-1a 

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-workflow-element \
  --element-name proxy-we-2a \
  --type proxy-ldap \
  --set enabled:true \
  --set client-cred-mode:use-client-identity \
  --set ldap-server-extension:proxy-extension-2a 

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-workflow-element \
  --element-name proxy-we-1b \
  --type proxy-ldap \
  --set enabled:true \
  --set client-cred-mode:use-client-identity \
  --set ldap-server-extension:proxy-extension-1b 

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-workflow-element \
  --element-name proxy-we-2b \
  --type proxy-ldap \
  --set enabled:true \
  --set client-cred-mode:use-client-identity \
  --set ldap-server-extension:proxy-extension-2b 

# Create a load balancing workflow element for each data center
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-workflow-element \
  --element-name LB-we-1a \
  --type load-balancing \
  --set enabled:true 

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-workflow-element \
  --element-name LB-we-1b \
  --type load-balancing \
  --set enabled:true 

# Define the load balancing algorithm for each data center
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-load-balancing-algorithm \
  --element-name LB-we-1a \
  --type proportional 

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-load-balancing-algorithm \
  --element-name LB-we-1b \
  --type proportional 

# Define the load balancing routes for each proxy 
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-load-balancing-route \
  --element-name LB-we-1a \
  --route-name LB-route-1a \
  --type proportional \
  --set workflow-element:proxy-we-1a 
 
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-load-balancing-route \
  --element-name LB-we-1a \
  --route-name LB-route-2a \
  --type proportional \
  --set workflow-element:proxy-we-2a 
 
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-load-balancing-route \
  --element-name LB-we-1b \
  --route-name LB-route-1b \
  --type proportional \
  --set workflow-element:proxy-we-1b 
 
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-load-balancing-route \
  --element-name LB-we-1b \
  --route-name LB-route-2b \
  --type proportional \
  --set workflow-element:proxy-we-2b 

# Set failover between the two data centers
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-workflow-element \
  --element-name FO-we1 \
  --type load-balancing \
  --set enabled:true 
  
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-load-balancing-algorithm \
  --element-name FO-we1 \
  --type failover 

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-load-balancing-route \
  --element-name FO-we1 \
  --route-name FO-route-1a \
  --type failover \
  --set workflow-element:LB-we-1a \
  --set add-priority:1 \
  --set bind-priority:1 \
  --set compare-priority:1 \
  --set delete-priority:1 \
  --set extended-priority:1 \
  --set modify-priority:1 \
  --set modifydn-priority:1 \
  --set search-priority:1  

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-load-balancing-route \
  --element-name FO-we1 \
  --route-name FO-route-1b \
  --type failover \
  --set workflow-element:LB-we-1b \
  --set add-priority:2 \
  --set bind-priority:2 \
  --set compare-priority:2 \
  --set delete-priority:2 \
  --set extended-priority:2 \
  --set modify-priority:2 \
  --set modifydn-priority:2 \
  --set search-priority:2  

#Create the second failover route
#Create a proxy LDAP extension for each remote LDAP server
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-extension \
  --type ldap-server \
  --extension-name proxy-extension-3a \
  --set enabled:true \
  --set remote-ldap-server-address:DS3a_hostname \
  --set remote-ldap-server-port:3189 

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-extension \
  --type ldap-server \
  --extension-name proxy-extension-4a \
  --set enabled:true \
  --set remote-ldap-server-address:DS4a_hostname \
  --set remote-ldap-server-port:3289 

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-extension \
  --type ldap-server \
  --extension-name proxy-extension-3b \
  --set enabled:true \
  --set remote-ldap-server-address:DS3b_hostname \
  --set remote-ldap-server-port:3389 

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-extension \
  --type ldap-server \
  --extension-name proxy-extension-4b \
  --set enabled:true \
  --set remote-ldap-server-address:DS4b_hostname \
  --set remote-ldap-server-port:3489 

#Create a proxy workflow element for each LDAP server extension
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-workflow-element \
  --element-name proxy-we-3a \
  --type proxy-ldap \
  --set enabled:true \
  --set client-cred-mode:use-client-identity \
  --set ldap-server-extension:proxy-extension-3a 

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-workflow-element \
  --element-name proxy-we-4a \
  --type proxy-ldap \
  --set enabled:true \
  --set client-cred-mode:use-client-identity \
  --set ldap-server-extension:proxy-extension-4a 

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-workflow-element \
  --element-name proxy-we-3b \
  --type proxy-ldap \
  --set enabled:true \
  --set client-cred-mode:use-client-identity \
  --set ldap-server-extension:proxy-extension-3b 

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-workflow-element \
  --element-name proxy-we-4b \
  --type proxy-ldap \
  --set enabled:true \
  --set client-cred-mode:use-client-identity \
  --set ldap-server-extension:proxy-extension-4b 

# Create a load balancing workflow element for each data center
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-workflow-element \
  --element-name LB-we-2a \
  --type load-balancing \
  --set enabled:true 

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-workflow-element \
  --element-name LB-we-2b \
  --type load-balancing \
  --set enabled:true 

# Define the load balancing algorithm for each data center
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-load-balancing-algorithm \
  --element-name LB-we-2a \
  --type proportional 

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-load-balancing-algorithm \
  --element-name LB-we-2b \
  --type proportional 

# Define the load balancing routes for each proxy 
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-load-balancing-route \
  --element-name LB-we-2a \
  --route-name LB-route-3a \
  --type proportional \
  --set workflow-element:proxy-we-3a 
 
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-load-balancing-route \
  --element-name LB-we-2a \
  --route-name LB-route-4a \
  --type proportional \
  --set workflow-element:proxy-we-4a 
 
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-load-balancing-route \
  --element-name LB-we-2b \
  --route-name LB-route-3b \
  --type proportional \
  --set workflow-element:proxy-we-3b 
 
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-load-balancing-route \
  --element-name LB-we-2b \
  --route-name LB-route-4b \
  --type proportional \
  --set workflow-element:proxy-we-4b 

# Set failover between the two data centers
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-workflow-element \
  --element-name FO-we2 \
  --type load-balancing \
  --set enabled:true 
  
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-load-balancing-algorithm \
  --element-name FO-we2 \
  --type failover 

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-load-balancing-route \
  --element-name FO-we2 \
  --route-name FO-route-2a \
  --type failover \
  --set workflow-element:LB-we-2a \
  --set add-priority:1 \
  --set bind-priority:1 \
  --set compare-priority:1 \
  --set delete-priority:1 \
  --set extended-priority:1 \
  --set modify-priority:1 \
  --set modifydn-priority:1 \
  --set search-priority:1  

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-load-balancing-route \
  --element-name FO-we2 \
  --route-name FO-route-2b \
  --type failover \
  --set workflow-element:LB-we-2b \
  --set add-priority:2 \
  --set bind-priority:2 \
  --set compare-priority:2 \
  --set delete-priority:2 \
  --set extended-priority:2 \
  --set modify-priority:2 \
  --set modifydn-priority:2 \
  --set search-priority:2  

# Create distribution to the two failover routes
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-workflow-element \
  --element-name distrib-we \
  --type distribution \
  --set base-dn:dc=example,dc=com \
  --set enabled:true 

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-distribution-algorithm \
  --element-name distrib-we \
  --type numeric \
  --set distribution-attribute:uid

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-distribution-partition \
  --element-name distrib-we \
  --partition-name distrib-part1\
  --type numeric \
  --set lower-bound:0 \
  --set upper-bound:1000 \
  --set partition-id:1 \
  --set workflow-element:FO-we1

dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-distribution-partition \
  --element-name distrib-we \
  --partition-name distrib-part2\
  --type numeric \
  --set lower-bound:1000 \
  --set upper-bound:2000 \
  --set partition-id:2 \
  --set workflow-element:FO-we2


# Create workflow
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-workflow \
  --workflow-name Distrib-workflow \
  --set enabled:true \
  --set base-dn:dc=example,dc=com \
  --set workflow-element:distrib-we 

# Create network group
dsconfig -p 4444 -h localhost -D"cn=Directory Manager" -j pwd-file -X -n \
create-network-group \
  --group-name network-group1 \
  --set enabled:true \
  --set workflow:Distrib-workflow \
  --set priority:1