Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Note
titleWork in progress

This site is in the process of being reviewed and updated.

Wiki Markup
{scrollbar}

Adding your own partition resp. suffix

...

In ApacheDS entries are stored in partitions. Each partition contains a complete entry tree, also referred to as a DIT. Multiple partitions may exist and the entry trees they contain are disconnected from each other, meaning that changes to entries in partition A would never affect entries in partition B. The entries in a particular partition are stored below some naming context called the partiton partition suffix.

The default implementation of partitions is based on JDBM B+Trees (but it's possible to add custom partition implementations). The ApacheDS default configuration contains a a data partition with the suffix "dc=example,dc=com".

Defining a partition

The following attributes are used when defining a partition's configuration:

...

The image below shows the suffixes of a freshly installed ApacheDS within Apache Directory Studio.

Image Added

The schema subsystem and ApacheDS itself store their information in special partitions, "ou=schema" and "ou=system" respectively.

Minimal partition definition

...

For the examples in the following sections, we want to add a partition with the suffix "o=sevenSeas" and the id "sevenSeasPartitionConfiguration". This requires editing of the conf/ server.xml file, and injecting a first entry, associated with the root of this partition (here, "o=sevenseas") . Open it

Open the server.xml file for your directory instance in your favorite editor and look for the following element with name contextPartitionConfigurations. Add another ref element for the sevenSeas partitionpartitions.

Code Block
xml
xml
<property name="contextPartitionConfigurations">
  <set>
    <ref bean="examplePartitionConfiguration"/>
    <ref bean="sevenSeasPartitionConfiguration"/>
  </set>
</property>

Now we will add the actual partition. Just copy & paste this set of elements in the configuration file:

Code Block
xmlxml

<bean id="examplePartitionConfiguration" 
class="org.apache.directory.server.core.partition.impl.btree.MutableBTreePartitionConfiguration">
    <property name="name" value="example" />
    <property name="cacheSize" value="100"/>
    <property name="suffix" value...
 <partitions>
  ...
  <jdbmPartition id="example" cacheSize="100" suffix="dc=example,dc=com" />
 optimizerEnabled="true"
   <property name="optimizerEnabled" value="true" />
    <property name="synchOnWrite" value="true" />
    <property namesyncOnWrite="indexedAttributestrue">
      <set><indexedAttributes>
        <bean class="org.apache.directory.server.core.partition.impl.btree.MutableIndexConfiguration">
          <property name="attributeId" value="dc" />
          <property name="cacheSize" value="100" />
        </bean>
        ...
        <bean class="org.apache.directory.server.core.partition.impl.btree.MutableIndexConfiguration">
          <property name="attributeId" value="objectClass" />
          <property name="cacheSize" value="100" />
        </bean>
      </set>
    </property>
    <property name="contextEntry">
      <value>
        objectClass: top
        objectClass: domain
        objectClass: extensibleObject
        dc: example
      </value>
    </property>
</bean>

Now we will update the elements step by step. First change the id to the value added to the contextPartitionConfiguration element.

Before:

...


<bean id="examplePartitionConfiguration"
class="org.apache.directory.server.core.partition.impl.btree.MutableBTreePartitionConfiguration">

After:

...


<bean id="sevenSeasPartitionConfiguration"
class="org.apache.directory.server.core.partition.impl.btree.MutableBTreePartitionConfiguration">

Next give the partition a name and change the suffix to o=sevenSeas
Before:

...


<property name="name" value="system" />
<property name="cacheSize" value="100" />
<property name="suffix" value="ou=system" />
<property name="optimizerEnabled" value="true" />
<property name="synchOnWrite" value="true" />
</indexedAttributes>
  </jdbmPartition>
 </partitions>
...

Add another jdbmPartition element for the sevenSeas partition, just below the example partition:

Code Block
xml
xml

...
<partitions>

 <jdbmPartition ...>
   ...
 </jdbmPartition>

 <jdbmPartition id="sevenSeas" suffix="o=sevenSeas" />

</partitions>
...

Save the server.xml file and restart the server. The server has a new suffix now, but no context entry has been created for it. If you connect with an LDAP Browser (Apache Directory Studio for instance), the partition is only visible in the Root DSE. Below the Properties dialog of Directory Studio for the Root DSE after connecting to an ApacheDS instance configured like above.

Image Added

Before using the partition (e.g. adding entries), you have to add a context entry. If you plan to load LDIF data to your partition anyway, simply provide the context entry (the "root" of your partition) as a first data set. In our example it might look like this:

Code Block

dn: o=sevenSeas
o: sevenSeas
objectClass: top
objectClass: organization
description: The context entry for suffix o=sevenSeas

It is also possible to import a file to ApacheDS which only contains such an entry, of cause. Here is an example on how to procede for the seven seas :

In the LDAP Browser of Directory Studio, right click on the DIT entry and select "Import -> LDIF Import...". A file selections dialog appears. Browse to the LDIF file and click Finish. The entry (or entries, if you provide more of them) will be added to to partition.

The following image depicts the partitions after reconnecting with Apache Directory Studio (LDAP Browser view).

Image Added

Laoding the context entry automatically on startup

If you don't want to launch Apache Studio, or to inject the LDIF file using a command line tool, you can also tells the server to load the file when it will be laucnhed the first time. Just create a ldif file containing the context entry, and add some tag into the server.xml file. For instance, you have created the sevenSeasRoot.ldif file containing

Code Block

# SevenSeas root context entry
dn: o=sevenSeas
o: sevenSeas
objectClass: top
objectClass: organization
description: The context entry for suffix o=sevenSeas

Now just modify the server.xml file to add this line :

Code Block

  ...
  <apacheDS id="apacheDS"
            synchPeriodMillis="15000"
            allowAnonymousAccess="false">

    <directoryService>#directoryService</directoryService>

    <!-- We load the SevenSeas root context entry here -->
    <ldifDirectory>sevenSeasRoot.ldif</ldifDirectory>
    ...

The contextEntry will be loaded when the server will be started the first time.

More configuration options for a JDBM partition

Here is a list of the used attributes, their default values and meaning

Property

Default value

Description

id

 

(required) uniquely identifies the partition

suffix

 

(required) an LDAP DN ("dc=example, dc=com", for instance)

cacheSize

-1

cache size expressed as a number of entries

optimizerEnabled

true

 

syncOnWrite

true

sync disks on every write operation

After:

...


<property name="name" value="The seven seas" />
<property name="cacheSize" value="100" />
<property name="suffix" value="o=sevenSeas" />
<property name="optimizerEnabled" value="true" />
<property name="synchOnWrite" value="true" />

Configuration of the indexed Attributes is described at #Configure indices.
The last property remaining now is the context entry. The object classes top and extensibleObject are universal hence they remain. But the object class domain is replaced by the object class organization, because our partition shouldn't represent a domain but an organization.
Before:

...


<property name="contextEntry">
    <value>
      objectClass: top
      objectClass: domain
      objectClass: extensibleObject
      dc: example
    </value>
</property>

After:

...


<property name="contextEntry">
  <value>
      objectClass: top
      objectClass: organization
      objectClass: extensibleObject
      o: sevenSeas
  </value>
</property>

Afterwards restart the server.

Resources

...