2.2.1 - debian Debian Instance Layout

When you run the installer ( sudo dpkg -i apacheds-<version>-<arch>.deb ) on your debian system, it will install the server on your disk, using this layout :

 /
 |
 +-- etc/
 |    |
 |    +-- init.d/
 |         |
 |         +-- apacheds-<version>-<instance>    The daemon used to start the server
 +-- opt/
 |    |
 |    +-- apacheds-<version>
 |         |
 |         +-- conf/
 |         |    |
 |         |    +-- wrapper.conf  The wrapper default configuration
 |         |
 |         +-- bin/
 |         |    |
 |         |    +-- apacheds*  The script that starts the server
 |         |    |
 |         |    +-- wrapper*  The binary that starts the server
 |         |
 |         +-- lib
 |         |    |
 |         |    +-- wrapper-3.2.3.jar
 |         |    |
 |         |    +-- libwrapper.so
 |         |    |
 |         |    +-- apacheds-wrapper-2.0.0-M20-SNAPSHOT.jar
 |         |    |
 |         |    +-- apacheds-service-2.0.0-M20-SNAPSHOT.jar
 |         |
 |         +-- NOTICE
 |         |
 |         +-- LICENSE
 |
 +-- var/
      |
      +--lib/
          |
          +-- apacheds-<version>/
            |
            +-- <instance>/   
                 |
                 +-- run/
                 |    |
                 |    +-- apacheds-default.pid  The PID of the running process
                 |
                 +-- partitions/  This is were your data will be stored
                 |    |
                 |    +-- schema/
                 |    |
                 |    +-- system/
                 |    |
                 |    +-- example/
                 |
                 +-- log/  This is were the logs are stored
                 |    |
                 |    +-- apacheds.log
                 |    |
                 |    +-- wrapper.log
                 |
                 +-- cache/  This is where the various caches are stored
                 |    |
                 |    +-- changePwdReplayCache.data
                 |    |
                 |    +-- ou=system.data
                 |    |
                 |    +-- groupCache.data
                 |    |
                 |    +-- kdcReplayCache.data
                 |
                 +-- conf/
                 |    |
                 |    +-- wrapper-instance.conf  The specific instance wrapper configuration
                 |    |
                 |    +-- log4j.properties  The log configuration file
                 |    |
                 |    +-- config.ldif  The server configuration. Don't manipulate this file with a text editor !
                 |
                 +-- syncrepl-data/

Defining an instance

The default installation comes with a default instance (aka 'default'). It’s possible to define more instances, it’s just enough to copy the directory /var/lib/apacheds-<version>/<instances>/default and give it the name of the new instance. Then, be sure to remove everything under the run/, partitions/, log/, syncrepl-data and cache/ directories to create a blank new instance. Here, we have created a blank test instance :

 /
 |
 +-- var/
      |
      +--lib/
          |
          +-- apacheds-<version>/
            |
            +-- test/   
                 |
                 +-- run/
                 |
                 +-- partitions/
                 |
                 +-- log/
                 |
                 +-- cache/
                 |
                 +-- conf/
                      |
                      +-- wrapper-instance.conf
                      |
                      +-- log4j.properties
                      |
                      +-- config.ldif

The next step is to be sure that the config.ldif file is modified to not conflict with any other instance of the server : it’s just a mater to change the port used by the server.

When the newly created instance will be created, the partitions will be created.

Starting the server

As we can have more than one instance, we have more than one instance in /var/lib/apacheds<version>/<instances> that can be installed. Each one of these instance can be started using the /etc/init.d/apacheds daemon, passing the instance as a parameter :

$ sudo /etc/init.d/apacheds-<version> start [<instance>]

The default instance name is ‘default’.

All the data for a given instance are stored into this /var/lib/apacheds-<version>/instances/<instance-name> directory.

Stopping the server

Stopping the server is done using the same command, with a different parameter :

$ sudo /etc/init.d/apacheds-<version> stop [<instance>]

Again, you must provide the instance name if it’s not the default one

Repairing the indexes

Sometime, the database get corrupted. Hopefully, this is not frequent, but when it happens, it left you in a position where there is nothing you can do but re-injecting a backup.

That is more than annoying, and the latest version (2.0.0-M23) as an added feature that allows you to repair the indexes (this is a best effort, it might not work in all cases). Here is the step to follow in order to run the tool :

$ sudo /etc/init.d/apacheds-<version> repair /var/lib/apacheds-<version>/<instance>

All the indexes will be recreated, based on the content of the master table (which contains all the entries). You can also remove all the database files but the master.db and master.lg files from each user partitions in /var/lib/apacheds-//partitions, before running the command.

The server should restart with a working database (it might take a bit of time, but not that much : rebuilding indexes is orders of magnitude faster than injcting entries in the server).

Logs

You can check what’s going on in the apacheds-<version>instances/<instance-name>/log/apacheds.log file, which is created using the configuration set in apacheds-<version>instances/<instance-name>/conf/log4j.properties.

Typically, when you start the server, you will get such log :

$ more apacheds.log
[10:53:05] WARN [org.apache.directory.server.core.DefaultDirectoryService] - You didn't change the admin password of 
directory service instance 'default'.  Please update the admin password as soon as possible to prevent a possible 
security breach.

and from the apacheds-<version>/instances/<instance-name>/log/apacheds.out file, which contains everything the server writes on the console, you will read :

$ more apacheds.out 
[10:53:05] WARN [org.apache.directory.server.core.DefaultDirectoryService] - You didn't change the admin password of 
directory service instance 'default'.  Please update the admin password as soon as possible to prevent a possible 
security breach.
           _                     _          ____  ____   
          / \   _ __    ___  ___| |__   ___|  _ \/ ___|  
         / _ \ | '_ \ / _` |/ __| '_ \ / _ \ | | \___ \  
        / ___ \| |_) | (_| | (__| | | |  __/ |_| |___) | 
       /_/   \_\ .__/ \__,_|\___|_| |_|\___|____/|____/  
               |_|                                       

Log configuration

You can configure the log level and content by changing the content of the /var/lib/apacheds-<version>/<instance>/<conf>/log4j.properties file.

The default configuration is given below :

log4j.rootCategory=WARN, R, stdout

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=${apacheds.log.dir}/apacheds.log

log4j.appender.R.MaxFileSize=1024KB
# Keep some backup files
log4j.appender.R.MaxBackupIndex=5

log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n

log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n

# with these we'll not get innundated when switching to DEBUG
log4j.logger.jdbm.recman.BaseRecordManager=FATAL
log4j.logger.org.apache.directory.server.OPERATION_LOG=FATAL
log4j.logger.org.apache.directory.server.OPERATION_TIME=FATAL
log4j.logger.org.apache.directory.api.CODEC_LOG=FATAL
log4j.logger.org.apache.directory.server.ACI_LOG=FATAL

# Replication logs
log4j.logger.org.apache.directory.server.PROVIDER_LOG=FATAL
log4j.logger.org.apache.directory.server.CONSUMER_LOG=FATAL

# Search log
log4j.logger.org.apache.directory.CURSOR_LOG=FATAL

# Other logs
log4j.logger.org.apache.directory.api=FATAL
log4j.logger.org.apache.directory.server=FATAL
log4j.logger.net.sf.ehcache=FATAL
log4j.logger.org.apache.mina=FATAL

JVM setting

Were you to change the memory you want to use for a given instance, you will have to modify the /var/lib/apacheds-<version>/<instances>/<conf>/wrapper-instance.conf file. Here are the parameter you can configure in this file :

##
## In this file you can override parameters specified in the default
## Apache Directory Server config file which is usually at
## /opt/apacheds-2.0.0-M20-SNAPSHOT/conf/wrapper.conf
##
## See also http://wrapper.tanukisoftware.org/doc/english/properties.html
## For a list of properties that can be set.
##

## Override the JRE used
# wrapper.java.command=<path-to-java-executable>

## Override the JVM memory settings
## Initial Java Heap Size (in MB)
# wrapper.java.initmemory=1024

## Maximum Java Heap Size (in MB)
# wrapper.java.maxmemory=2048

You mainly want to change the memory used by the JVM.