OpenDJ: Installation and Multi-Master Replication Configuration

OpenDJ is a fork of the OpenDS directory server, with OpenDS originally being developed by Sun. Sun went its own way with JDS, and OpenDS was developed for a while by the community. ForgeRock came along and forked the stale project off (the last OpenDS release was back in 2010) and have been actively developing and since then have been releasing builds as OpenDJ. OpenDJ forms part of the complete ForgeRock open-identity stack, fully supported, and is a very viable alternative to the Sun/Oracle IDM stack. OpenDS, and therefore OpenDJ, are pure Java implementations.

In this article, I will install and configure OpenDJ on two nodes running Oracle Enterprise Linux 5.7 x86_64. OpenDJ will be configured with multi-master replication between both nodes. The same procedure should work on any RHEL 5.x or 6.x derivative. Node names are foo-0001prjenv and foo-0002prjenv.

You should obtain the latest versions of all software for your platform.

JDK Installation

First, install appropriate JDKs on both servers. I am installing the x86_64 versions of both Oracle’s 1.6 and 1.7 JDKs. This will give us the flexibility to choose which version of Java we run (and also these hosts require some other software down the track that’ll only work with Java 1.6 - not pertinent to this article).

Download and install your JDKs. This article presumes that all downloaded software is in /var/tmp, and that you’re installing to locations under /app:

So we now have our JDKs installed under /app/jdk/<version>. For OpenDJ, we’ll use jdk1.7.0_07. If you use the latest JDK, check the OpenDJ release notes to ensure that it is supported.

Preparing to Install OpenDJ

Next, add a user and group for opendj, and set an appropriate password:

LDAP implementations sometimes need to open a vast number of files during the course of operation. Therefore, set high soft and hard resource limits for the opendj user in /etc/security/limits.conf for nofile (number of open file descriptors):

OpenDJ Installation

Next, install OpenDJ on both nodes:

Switch user to opendj, and set the JAVA_HOME and OPENDJ_JAVA_HOME variables as appropriate:

Source the new profile to configure your environment:

Next, fire up the OpenDJ setup utility in command line mode:

The full session transcript will follow from foo-0001prjenv - perform the same steps on both nodes, substituting appropriate values for your environment:

To note from the session above, we configure and create a base DN of dc=example,dc=com, enable SSL (with a self-signed certificate), and tell setup not to start the server after setup has completed.

Add entries for both nodes to /etc/hosts on both servers, even if you have DNS configured appropriately, as an extra precaution against nameserver failure:

Finally, start the OpenDJ server on each node, observing the output messages during startup for errors.

Replication Configuration

We now have two servers running OpenDJ, listening on port 1389 for standard LDAP and 1636 for LDAPS. The servers also listen on port 4444 for administrative commands.

With the servers ready to go, we can configure replication. This is done with the dsreplication command via its enable subcommand as follows; perform this step on a single node (in my case foo-0001prjenv). A discussion will follow the session output.

We configure SSL-based replication, and supply all appropriate DNs and credentials. Substitute parameters as applicable to your environment.

Next, on foo-0002prjenv, initalise the base DN we wish to replicate - dc=example, dc=com.

If no errors are reported, replication is now successfully configured. You can verify this with the dsreplication status command:

Conclusion

This article has covered the installation of OpenDJ - a supported fork of OpenDS. It has shown how to configure multi-master replication of a base DN between two instances of the directory.