Skip to content
SDI-Docs

Backup and Restore

First, we create a second LDAP server on sdi01b.mi.hdm-stuttgart.de like described in Install LDAP Server

Then we dump the configuration of the a server into ldif files by doing so

slapcat -b cn=config -l ldap-config.ldif
slapcat -l ldap-data.ldif

Now we need to create an ssh-key on sdi01a and add the public key to authorized_keys file on sdi01b. Then we can use scp to transfer the files from sdi01a to sdi01b.

ssh-keygen -t dsa

Add the Generated key to the other server in ~/.ssh/authorized_keys

Now transfer the files

scp {ldap-config.ldif,ldap-data.ldif} [email protected]:~

On sdi01b we need to stop the slapd service with systemctl stop slapd and now restore the configuration and data using slapadd

slapadd -b cn=config -l ~/ldap-config.ldif -F /etc/ldap/slapd.d/
slapadd -n 1 -l ~/ldap-data.ldif -F /etc/ldap/slapd.d/

To see if everything worked we can create a new ldif file based on the new ldap server and open it to know it worked.

slapcat -l ldap-data-b.ldif