Store Directory Data in Cassandra

This recipe preserves the Cassandra backend setup from the wiki’s task collection. It requires a reachable Cassandra cluster and a data center name matching that cluster’s configuration. Prepare a fresh OpenDJ installation from the full server ZIP (not the slim ZIP, which omits the Cassandra driver), without a base DN, using only the ./setup command in the JDBC setup procedure. Do not run its create-backend command: the Cassandra backend below will use the same userRoot name.

Setup starts the server without OPENDJ_JAVA_ARGS. After setup finishes, append the driver settings to every java-args value in config/java.properties and restart the server before creating the backend. The server and offline tools such as import-ldif --offline and rebuild-index each read their own Java arguments. For a local Cassandra node on port 9042 in data center datacenter1:

unset OPENDJ_JAVA_ARGS
sed -i.bak 's/^[a-z0-9.-]*java-args=.*/& -Ddatastax-java-driver.basic.contact-points.0=localhost:9042 -Ddatastax-java-driver.basic.load-balancing-policy.local-datacenter=datacenter1/' config/java.properties
bin/stop-ds
bin/start-ds

The start scripts ignore the Java arguments in config/java.properties while OPENDJ_JAVA_ARGS is set. Leave it unset in shells and services that start the server or run offline tools. Configure authentication and TLS in the driver for a secured cluster. Create the backend with keyspace name ldap_example_com:

bin/dsconfig create-backend --hostname localhost --port 4444 \
  --bindDN 'cn=Directory Manager' --bindPassword password \
  --backend-name userRoot --type cas \
  --set db-directory:ldap_example_com --set base-dn:dc=example,dc=com \
  --set enabled:true --trustAll --no-prompt

Follow Generate and Load Test LDIF Data to add entries and check LDAP searches. Choose Cassandra replication and durability settings for your topology before using this backend for persistent directory data; this local recipe does not configure a production cluster.