LDAP is Lightweight Directory Access Protocol. It is a way to communicate with directory services. And for many years it has proved its reliability to organize and keep various type of information, for instance, user accounts. It’s useful if you want to provide one credentials for accessing to different resources – servers, web pages, etc.
OpenLDAP is open source implementation of the LDAP.
Once LDAP server is set and running you need to take care about backups.
If your LDAP backend is one of bdb, hdb or null you can use slapcat. To check it see /etc/ldap/slapd.conf.
Here is an example:
debian:~# /usr/sbin/slapcat -v -l /home/backup/ldap.diff
Full backup script:
#!/bin/sh LDAPBK=ldap-$( date +%y%m%d-%H%M ).ldif BACKUPDIR=/home/backups <pre>/usr/sbin/slapcat -v -b "dc=yourDC,dc=local" -l $BACKUPDIR/$LDAPBK gzip -9 $BACKUPDIR/$LDAPBK
You should just change LDAP suffix from “dc=yourDC,dc=local” to your actual one.
To restore you should perform the following steps.
1. stop slapd daemon:
debian:~# /etc/init.d/slapd stop
2. delete old database (make sure you are in right directory to use rm):
debian:~# cd /var/lib/ldap
rm -rf *
2. Restore database from LDIF file:
debian:~# /usr/sbin/slapadd -l backup.ldif
4. run slapd daemon:
debian:~# /etc/init.d/slapd start
Didn’t find the answer to your question? Ask it our administrators to reply we will publish on website.