Backup CentOS or Redhat Directory Server Database (LDAP)

in Categories , , , last updated August 27, 2007

Q. How can I backup Fedora / CentOS / Redhat Linux Directory server database?

A. You can back up your databases from the command-line using the db2bak command-line script. This script works when the server is running or when the server is stopped. Run script as follows:
# ./db2bak
OR
# /path/to/installed-directory/db2bak

The db2back script will create a backup folder with a format of year_month_day__hour (YYYY_MM_DD_hh_mm_ss). The backup folder will contain the exported LDIF files and other Berkeley databases (.db4 files).

Restore backup

First stop server:
#./stop-slapd

Next restore the backup database. For example:
#./bak2db /path/to/bak/2007_02_02_01_02_12/

Again start the Red Hat Directory Server:
# ./start-nslapd

References:

=> Populating Directory Databases – Red Hat Directory Server

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Share this on (or read 0 comments/add one below):