Matteo Mattei

Hello, my name is Matteo Mattei and this is my personal website. I am computer engineer with a long experience in Linux system administration and web software development.

linkedin rss twitter google+ github facebook

Backup & Restore LDAP database

The today question is: did you ever happened to make an hot backup of an LDAP database? I will show you how to do it creating an LDIF file and then doing the respective restore (in the hope you will not really need it). After all it is quite simple…

BACKUP:

ldapsearch -x -b "dc=example,dc=com" -h 192.168.0.1 -D "cn=manager,dc=example,dc=com" -w secret_password "(objectclass=*)" > backup_file.ldif

RESTORE:

The new database must be empty!

ldapadd -D "cn=manager,dc=example,dc=com" -x -w secret_password -h 192.168.0.1 -f backup_file.ldif

Here there is the meaning of the parameters used:

comments powered by Disqus