Chapter 1. Backing up Directory Server
A backup in Directory Server contains the following files:
-
An LDIF file
dse_index.ldif
containing database indexed attributes -
An LDIF file
dse_instance.ldif
containing instance configuration attributes -
A directory for each backend, for example
userRoot
, which contains.db
files for indexes defined in the database -
A transaction log file
log.*
-
A database version file
DBVERSION
Note that Directory Server does not support backing up individual databases.
For details about backing up other important files, such as the configuration, see Backing up configuration files, the certificate database, and custom schema files.
In contrast to a backup, you can export data as described in Exporting data from Directory Server. Use the export feature to export specific data from a server, such as a subtree, in LDIF format.
1.1. Backing up all databases using the command line while the instance is running
To back up all databases of the Directory Server instance that is running, use the dsconf backup create
command.
Directory Server cleans the changelog when the database is restored from the online backup. Therefore, using online backup requires you to reinitialize the replica after the database restore. To avoid reinitialization, use the offline backup.
Prerequisites
The
dirsrv
user has write permissions in the destination directory.Note that Directory Server uses its own private directories by default. As a result, backups and exports under directories
/var/tmp/
,/tmp/
, and/root/
fail unless you disabled the PrivateTmp systemd directive.- The Directory Server instance is running.
Procedure
Back up all databases:
#
dsconf -D "cn=Directory Manager" ldap://server.example.com backup create
The backup create task has finished successfullyBy default,
dsconf
stores the backup in a subdirectory calledinstance_name-YYYY_MM_DD_hh_mm_ss
in the/var/lib/dirsrv/slapd-instance_name/bak/
directory. To specify a different location, append a directory name to the command.-
Search the
/var/log/dirsrv/slapd-instance_name/errors
log for problems during the backup.
Additional resources
-
To display all additional settings that you can use to back up data, see the output of the
dsconf ldap://server.example.com backup create --help
command. - Backing up configuration files, the certificate database, and custom schema files
- Restoring all databases using the command line while the instance is running
- Exporting data from Directory Server
1.2. Backing up all databases using the command line while the instance is offline
To back up databases when the Directory Server instance is offline, use the dsctl db2bak
command.
Prerequisites
The
dirsrv
user has write permissions in the destination directory.Note that Directory Server uses its own private directories by default. As a result, backups and exports under directories
/var/tmp/
,/tmp/
, and/root/
fail unless you disabled the PrivateTmp systemd directive.- The Directory Server instance is not running.
Procedure
Back up all databases:
#
dsctl instance_name db2bak
db2bak successfulBy default,
dsctl db2bak
stores the backup in theinstance_name-YYYY_MM_DD_hh_mm_ss
subdirectory in the/var/lib/dirsrv/slapd-instance_name/bak/
directory. To specify a different location, append a directory name to the command.Optionally, pass the
-v
option to the command to display verbose output:#
dsctl -v instance_name db2bak
... DEBUG: Instance allocated DEBUG: systemd status -> True ... INFO: db2bak successful-
Search the
/var/log/dirsrv/slapd-instance_name/errors
log for problems during the backup. Optional: Start the instance:
#
dsctl instance_name start
1.3. Backing up all databases using the web console
Directory Server supports data backup using the web console.
Directory Server cleans the changelog when the database is restored from the online backup. Therefore, using online backup requires you to reinitialize the replica after the database restore. To avoid reinitialization, use the offline backup.
Prerequisites
The
dirsrv
user has write permissions in the destination directory.Note that Directory Server uses its own private directories by default. As a result, backups and exports under
/var/tmp/
,/tmp/
, and/root/
directories fail unless you disabled the PrivateTmp systemd directive.- You are logged in to the instance in the web console.
Procedure
-
Click the
Manage Backups
. button, and select - Click .
- Enter a name for the backup, such as a time stamp to indicate the creation date and time of the backup.
- Click .
-
To check the log for problems during the backup, open the
menu.
The server stores the backup in a subdirectory with the name you entered in the /var/lib/dirsrv/slapd-instance_name/bak/
directory.
1.4. Backing up configuration files, the certificate database, and custom schema files
When you back up databases while the instance is online or offline, Directory Server also backs up configuration files, the certificate database, and custom schema files. The dsconf backup create
and dsctl db2bak
commands back up files to the /var/lib/dirsrv/slapd-instance_name/bak/example_backup/config_files/
backup default directory. You might need these files to restore the instance on a different server after a hardware failure.
During the backup, do not update the certificate database. Otherwise, this database might not be consistent in the backup.
Procedure
- Perform backup of Directory Server while the instance is running or is offline as described in Backing up all databases using the command line while the instance is running or Backing up all databases using the command line while the instance is offline.
Verification
Find backed up configuration files in the backup directory:
# ls /var/lib/dirsrv/slapd-instance_name/bak/example_backup/config_files/
NoteDirectory Server does not automatically restore backed up configuration files. You need to restore these files manually.
Additional resources