Moorfleeter Deich 216, 22113 Hamburg
+49 1774661716info@bastcom.deMo. - Fr.: 09:00 - 18:00

Blog

ITWeb Knowledge

Das bastCOM-Blogarchiv: Wissen und Anleitungen aus der Web- und IT-Praxis.

How to Export/Import Openldap (CentOS)

← Zurück zum Blog

Einführung in die LDAP-Datenbankverwaltung

LDAP (Lightweight Directory Access Protocol) ist ein verbreitetes Protokoll zur Verwaltung von Benutzerinformationen und Authentifizierungsdaten. Die Sicherung und Wiederherstellung einer LDAP-Datenbank ist entscheidend, um Datenverluste zu vermeiden und eine reibungslose Systemverwaltung sicherzustellen. Diese Anleitung beschreibt, wie Sie Ihre LDAP-Datenbank exportieren, importieren und mit möglichen Fehlern umgehen können.

Exporting the LDAP Database

Use slapcat to export your LDAP database to an LDIF file:

slapcat > backup.ldif

Importing the LDAP Database

Before importing, ensure the LDAP server is stopped:

service ldap stop

Then, import the database using slapadd:

slapadd -l backup.ldif

After importing, restart the LDAP service:

service ldap start

Handling Duplicate Data Errors

If you encounter an error stating that the same data already exists in the database, you may need to remove the old database before importing.

To do this on CentOS, navigate to the LDAP data directory and delete its contents:

cd /var/lib/ldap/
rm -rf *

⚠️ WARNING: Only delete the contents of /var/lib/ldap/, not other system files!