10.1. Backing Up Directory Data

A bak/ directory is provided when you install OpenDJ, as a location to save binary backups. When you create a backup, the bak/backup.info contains information about the archive.

Archives produced by the backup command contain backups only of the directory data. Backups of server configuration are found in config/archived-configs/.

Procedure 10.1. To Back Up Data Immediately

To perform online backup, you start backup as a task by connecting to the administrative port and authenticating as a user with the backend-backup privilege, and also setting a start time for the task by using the --start option.

To perform offline backup when OpenDJ is stopped, you run the backup command without connecting to the server, authenticating, or requesting a backup task.

  • Use one of the following alternatives.

    • Back up only the database for Example.com, where the data is stored in the backend named userRoot.

      The following example requests an online backup task that starts immediately, backing up only the userRoot backend.

      $ backup
       --port 4444
       --bindDN "cn=Directory Manager"
       --bindPassword password
       --backendID userRoot
       --backupDirectory /path/to/opendj/bak
       --start 0
      Backup task 20110613143715983 scheduled to start Jun 13, 2011 2:37:15 PM CEST
    • Stop the server to back up Example.com data offline.

      The following example stops OpenDJ, runs offline backup, and starts the server after backup has completed.

      $ stop-ds 
      Stopping Server...
      
      [13/Jun/2011:14:31:00 +0200] category=BACKEND severity=NOTICE msgID=9896306
       msg=The backend userRoot is now taken offline
      [13/Jun/2011:14:31:00 +0200] category=CORE severity=NOTICE msgID=458955
       msg=The Directory Server is now stopped
      $ backup --backendID userRoot -d /path/to/opendj/bak
      [13/Jun/2011:14:33:48 +0200] category=TOOLS severity=NOTICE msgID=10944792
       msg=Starting backup for backend userRoot
      [13/Jun/2011:14:33:48 +0200] category=JEB severity=NOTICE msgID=8847446
       msg=Archived: 00000000.jdb
      [13/Jun/2011:14:33:48 +0200] category=TOOLS severity=NOTICE msgID=10944795
       msg=The backup process completed successfully
      $ start-ds
      ... The Directory Server has started successfully
    • Back up all user data on the server.

      The following example requests an online backup task that starts immediately, backing up all backends.

      $ backup
       --port 4444
       --bindDN "cn=Directory Manager"
       --bindPassword password
       --backUpAll
       --backupDirectory /path/to/opendj/bak
       --start 0
      Backup task 20110613143801866 scheduled to start Jun 13, 2011 2:38:01 PM CEST

Procedure 10.2. To Schedule Data Backup

You can schedule online data backup using crontab format.

  • Back up all user data every night at 2 AM, and notify diradmin@example.com when finished, or on error.

    $ backup
     --port 4444
     --bindDN "cn=Directory Manager"
     --bindPassword password
     --backUpAll
     --backupDirectory /path/to/opendj/bak
     --recurringTask "00 02 * * *"
     --completionNotify diradmin@example.com
     --errorNotify diradmin@example.com
    Recurring Backup task BackupTask-988d6adf-4d65-44bf-8546-6ea74a2480b0
    scheduled successfully