OpenDJ will create and configure an initial backend during setup, but it is easy to create additional backends as needed.
One of the nice features introduced in Sun Directory 5 was the ability to create multiple database backends on a single server. This allowed you to cleanly partition your data as well as indexes between different base dns. So, for example, in a user directory you could have one dn with its own database and custom indexing for:
and then another for:
This arrangement is also helpful in application configuration directories where you want to carefully control changes made by an installer but also use memory, disk and network (IP address, listening port) resources as efficiently as possible.
To create a new backend:
dsconfig create-backend --backend-name appRoot --set-base-dn:dc=app,dc=example,dc=com --set enabled:true -t local-db -p 5445 -j $HOME/etc/pwd.txt -X -n
Once you’ve created the backend, you’ll want to create a root entry. First make an LDIF file with your data:
dn: dc=app,dc=example,dc=com objectclass: top objectclass: domain dc: app1
Then import it:
import-ldif -b dc=app,dc=example,dc=com -n appRoot -l $HOME/appRoot.ldif -t 0 -p 5445 -j $HOME/etc/pwd.txt -X
If you mess up and need to delete your new backend:
dsconfig delete-backend --backend-name appRoot --force -p 5445 -j $HOME/etc/pwd.txt -X
If all you wanted to do was add a new basedn to an existing database you’d invoke the following:
dsconfig set-backend-prop --backend-name userRoot --add base-dn:dc=app,dc=example,dc=com -p 5445 -j $HOME/etc/pwd.txt
Then import your root entry as shown above (just be sure to specify the actual backend-name, in this example “userRoot”).
To remove a basedn:
dsconfig set-backend-prop --backend-name userRoot --remove base-dn:dc=app,dc=example,dc=com -p 5445 -j $HOME/etc/pwd.txt