Language and Page Formatting Options
6.4. Restoring Directory Server
In certain situations, administrators want to restore Directory Server, for example, after a hardware failure. This section describes the supported restore methods.
Directory Server does not support restoring individual databases.
Directory Server runs the restore operation as the
dirsrvuser. Therefore, the permissions of the directory containing the backup must allow this user to read the files.
6.4.1. Restoring All Databases Using the Command Line
Directory Server supports restoring databases while the instance is running or while the instance is offline:
- Use one of the following methods if the instance is running:
- Use the
dsconf backup restorecommand. See Section 188.8.131.52.1, “Restoring All Databases Using the
dsconf backup restoreCommand”.
- Create a
cn=tasksentry. See Section 184.108.40.206.2, “Restoring all Databases Using a
- If the instance is offline, use the
dsctl bak2dbcommand. See Section 220.127.116.11, “Restoring all Databases While the Server is Offline”.
18.104.22.168. Restoring All Databases While the Server is Running
22.214.171.124.1. Restoring All Databases Using the
dsconf backup restore Command
dsconf backup restorecommand to automatically create a task that restores up all databases from a backup directory.
For example, to restore the backup stored in the
# dsconf -D "cn=Directory Manager" ldap://server.example.com backup restore /var/lib/dirsrv/slapd-instance_name/bak/instance_name-time_stamp/ The backup restore task has finished successfully
126.96.36.199.2. Restoring all Databases Using a
cn=tasks,cn=configentry in the Directory Server configuration is a container entry for temporary entries the server uses to manage tasks. To initiate a restore operation, create a task in the
Using a restore task overrides all data in the instance.
A restore task entry requires the following attributes:
cn: Sets the unique name of the task.
nsArchiveDir: Sets the path to the directory that contains the backup.
nsDatabaseType: Sets the type of the database to restore. Directory Server supports only the
ldbm databasevalue in this attribute.
For example, to add a task that restores all databases from the backup stored in the
# ldapadd -D "cn=Directory Manager" -W -H ldap://server.example.com -x dn: cn=example_restore,cn=import,cn=tasks,cn=config changetype: add objectclass: extensibleObject cn: example_restore nsArchiveDir: /var/lib/dirsrv/slapd-instance_name/bak/instance_name-time_stamp/ nsDatabaseType: ldbm database
When the task is completed, the entry is removed from the directory configuration.
188.8.131.52. Restoring all Databases While the Server is Offline
If the server is offline when you restore databases, use the
- Stop the instance:
# dsctl instance_name stop
- Restore the databases. For example, to add a task that restores all databases from the backup stored in the
# dsctl instance_name bak2db /var/lib/dirsrv/slapd-instance_name/bak/instance_name-time_stamp/ bak2db successful
dsctl bak2dbcommand runs as the restore as the
dirsrvuser. Therefore, the permissions of the source directory must allow this user to read files and directories.
- Start the instance:
# dsctl instance_name start
6.4.2. Restoring All Databases Using the Web Console
To restore all database using the web console:
- Open the Directory Server user interface in the web console. See Section 1.4, “Logging Into Directory Server Using the Web Console”.
- Select the instance.
- Click the Actions button, and select Manage Backups.The displayed window lists the available backups in the
- Open the Actions menu next to the backup you want to restore, and select Restore Backup.
- Click Yes to confirm.
6.4.3. Restoring Databases That Include Replicated Entries
Several situations can occur when a supplier server is restored:
- The consumer servers are also restored.For the very unlikely situation, that all databases are restored from backups taken at exactly the same time (so that the data are in sync), the consumers remain synchronized with the supplier, and it is not necessary to do anything else. Replication resumes without interruption.
- Only the supplier is restored.If only the supplier is restored or if the consumers are restored from backups taken at a different times, reinitialize the consumers for the supplier to update the data in the database. If only the supplier is restored or if the consumers are restored from backups taken at a different times, reinitialize the consumers for the supplier to update the data in the database.
- Changelog entries have not yet expired on the supplier server.If the supplier's changelog has not expired since the database backup was taken, then restore the local consumer and continue with normal operations. This situation occurs only if the backup was taken within a period of time that is shorter than the value set for the maximum changelog age attribute,
nsslapd-changelogmaxage, in the
cn=changelog5,cn=configentry. For more information about this option, see the Red Hat Directory Server Configuration, Command, and File Reference.Directory Server automatically detects the compatibility between the replica and its changelog. If a mismatch is detected, the server removes the old changelog file and creates a new, empty one.
- Changelog entries have expired on the supplier server since the time of the local backup.If changelog entries have expired, reinitialize the consumer. For more information on reinitializing consumers, see Section 15.8.3, “Initializing a Consumer”.
Example 6.3. Restoring a Directory Server Replication Topology
For example, to restore all servers in a replication environment, consisting of two suppliers and two consumer server:
- Restore the first supplier. Use the
dsconf backend importcommand to import the data. See Section 6.1.2, “Importing Using the Command Line”.
- Online-initialize the remaining servers by using replication:
For details, see Section 15.8.3, “Initializing a Consumer”.
- Initialize the second supplier from the first one.
- Initialize the consumers from the supplier.
- On each server, display the replication status to verify that replication works correctly. For details, see Section 15.22, “Displaying the Status of a Specific Replication Agreement”.
The changelog associated with the restored database will be erased during the restore operation. A message will be logged to the supplier servers' log files indicating that reinitialization is required.
For information on managing replication, see Chapter 15, Managing Replication.