12.4. Using the Distribution Logic Examples

The directory provides three distribution logic examples. The examples illustrate the following:
  • Distributing entries based on the first letter of their RDN (alpha_distribution).
    The example uses as many databases as you like to contain the data. For example, if you create three databases for a single suffix, entries starting with the letters A-I go to database 0, entries starting with the letters J-R go to database 1, and entries starting with the letters S-Z go to database 2. If you create 26 databases, each database would receive the entries for one letter of the alphabet.
  • Distributing entries based on a simple hash algorithm (hash_distribution).
    In this example, entries are randomly distributed using a hash algorithm on the RDN to compute the database to which the entry will be written.
  • Chaining entries to a read-write replica from a read-only replica (chaining_distribution).
    Usually the directory returns a referral to clients making update requests to a read-only replica. This example uses a distribution function on a suffix that contains both a read-only database and a database link. When the read-only database receives an update request, it forwards the request using the database link to a read-write database. The database link needs to be configured to chain on update.
    For information on configuring database links, refer to the Creating Directory Entries chapter in the Red Hat Directory Server Administration Guide.
The following directory contains the uncompiled C code examples: /usr/lib64/dirsrv/plugins/
This directory contains the distrib.c file, which contains three example functions (alpha_distribution, hash_distribution, and chaining_distribution) and a Makefile for compiling them.
After you have compiled the source code, there is a distrib-plugin.so.
For example, to use the hash distribution function:
  1. Create a suffix.
  2. Create several databases under that suffix.
  3. Import the suffix entry to each of the databases you created.
  4. Add the following lines to the suffix:
    nsslapd-distribution-plugin: /plugin/distrib-plugin.so
    nsslapd-distribution-funct: hash_distribution