HowTo Reload a Server’s Database
There are times that a server is too far out of date for
delta-syncrepl
to synchronize or that you are bringing a
server online and need to load the database.
Reload instructions:
Substitute your directory’s suffix for “dc=sample,dc=com” in the two mentions below. On the node with the known good database (probably your primary Master/Producer), do the following to export the database to an ldif file using slapcat:
Database export
sudo slapcat -F /opt/symas/etc/openldap/slapd.d -b "dc=sample,dc=com" -l <filename>.ldif
Transfer the ldif file to the server to reload
scp <filename>.ldif <host>:<directory>
The following will be done on the server to be reloaded
Stop slapd
sudo systemctl stop slapd
Ensure slapd is stopped
sudo systemctl status slapd
Clear existing database files
sudo rm -Rf /var/symas/openldap-data/*
Import the LDIF file
sudo slapadd -F opt/symas/etc/openldap/slapd.d -b "dc=sample,dc=com" -l <filename>.ldif -q
If
you are running slapd
with a different user and group than
root
, change owner (and group) for
/var/symas/openldap-data
directory and its file(s):
sudo chown -R openldap:openldap /var/symas/openldap-data
Start slapd
sudo systemctl start slapd
Check slapd status
sudo systemctl status slapd