OpenDJ: Control Panel CLI equivalents

OpenDJ community logo OpenDJ Control Panel can make your life easier, especially in your lab or on your laptop. But how do you perform the same operations as scripted commands?

A few hints follow:

Directory Data menu

  • Manage Entries: Vast subject. See the Admin Guide chapter on Performing LDAP Operations. The chapter shows lots of examples.
  • New Base DN…: You can add a new base DN to a backend with dsconfig.
    dsconfig set-backend-prop \
              --backend-name userRoot \
              --add base-dn:dc=example,dc=com \
              --hostname localhost \
              --port 4444 \
              --trustStorePath /path/to/OpenDJ/config/admin-truststore \
              --bindDN cn=Directory\ Manager \
              --bindPassword ****** \

    After you add the base DN, you can for example add a base entry with ldapmodify:

    /path/to/OpenDJ/bin/ldapmodify -p 1389 -D "cn=Directory Manager" -w password -a
    dn: dc=example,dc=com
    objectClass: domain
    objectClass: top
    dc: example
    Processing ADD request for dc=example,dc=com
    ADD operation successful for DN dc=example,dc=com

    You might want to do more, though, like generating and importing a bunch of entries from LDIF…

  • Import LDIF… & Export LDIF…: See the Admin Guide chapter on Importing & Exporting LDIF Data. The chapter shows you how to use the import-ldif and export-ldif commands. It also covers using make-ldif to generate as many entries as you want.
  • Backup… & Restore…: Read Backing Up & Restoring Data. The tools you want are appropriately named backup and restore.

Schema menu

  • Manage Schema: See the Admin Guide chapter on Managing Schema.
    The trick to schema is getting your syntax correct. So you might want to do all your work in OpenDJ Control Panel first on a test server. In most cases, you want to avoid updating existing schema definitions, instead creating new custom definitions.
    OpenDJ directory server will store your new definitions in /path/to/OpenDJ/config/schema/99-user.ldif. You can either edit a copy to turn it into a set of LDIF modifications that you then add to another OpenDJ directory server with the ldapmodify command, or you can copy the whole file to another replication topology and add it under /path/to/OpenDJ/config/schema.
    If you plan on having different sets of custom schema definitions, you might want to keep them in different files.

Indexes menu

Monitoring menu

  • General Information & Connection Handler: You can display some useful information with the status  command:
    /path/to/OpenDJ/bin/status \
         --script-friendly \
         --bindDN "cn=Directory Manager" \
         --bindPasswordFile /tmp/pwd

    There is also a boatload of information to be had under cn=monitor:

    /path/to/OpenDJ/bin/ldapsearch -p 1389 -b cn=monitor objectclass=\*

    Also read the Admin Guide chapter on Monitoring Servers.

  • Manage Tasks: See manage-tasks.

Runtime Options menu

  • Set OPENDJ_JAVA_HOME and OPENDJ_JAVA_ARGS in your scripts, or
  • Edit /path/to/OpenDJ/config/, and run /path/to/OpenDJ/bin/dsjavaproperties.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s