6.4. Restoring Directory Server
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
- Use one of the following methods if the instance is running:
- Use the
dsconf backup restorecommand. See Section 126.96.36.199.1, “Restoring All Databases Using the
dsconf backup restoreCommand”.
- Create a
cn=tasksentry. See Section 188.8.131.52.2, “Restoring all Databases Using a
- If the instance is offline, use the
dsctl bak2dbcommand. See Section 184.108.40.206, “Restoring all Databases While the Server is Offline”.
220.127.116.11. Restoring All Databases While the Server is Running
18.104.22.168.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.
# 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
22.214.171.124.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
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.
# 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
126.96.36.199. Restoring all Databases While the Server is Offline
- 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/ OK group dirsrv exists OK user dirsrv exists [20/Jul/2018:15:52:24.932598675 +0200] - INFO - ldbm_instance_config_cachememsize_set - force a minimal value 512000 ... 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.If you not append a destination directory to the command, the server stores the backup in a subdirectory called
- Start the instance:
# dsctl instance_name start
6.4.2. Restoring All Databases 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 Manage Backups.button, and selectThe displayed window lists the available backups in the
- Open the Actions menu next to the backup you want to restore, and select .
- Clickto confirm.
6.4.3. Restoring Databases That Include Replicated Entries
- 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.7.3, “Initializing a Consumer”.
Example 6.3. Restoring a Directory Server Replication Topology
- Restore the first master. 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.7.3, “Initializing a Consumer”.
- Initialize the second master from the first one.
- Initialize the consumers from the master.
- On each server, display the replication status to verify that replication works correctly. For details, see Section 15.21, “Displaying the Status of a Specific Replication Agreement”.