11

Is it possible to export all the data inside openldap for example using ldapsearch or some other tool to a (ldif?) file and then import everything on another server and put this in a script that would be run every day. So that I could use the other one as a backup when the first/master server is not available?

I have full access to the first/master server, but I can't modify it's configuration so I think I can't set up replication.

Jure1873
  • 3,762

2 Answers2

17

Is it possible to export all the data inside openldap for example using ldapsearch or some other tool to a (ldif?) file

Sure, it is possible. slapcat/slapadd is what you're looking for:

slapcat -f /path/to/the/slapd.conf -l backup.ldif
slapadd -v -c -l backup.ldif -f /path/to/the/slapd.conf 

These are basically offline tools, you should stop slapd before proceeding. Maybe you also have to set/fix file permissions after restore.

cstamas
  • 6,917
quanta
  • 52,423
1

Expanding on my comment above - Under OpenLDAP 2.4+ (current stable version is 2.6)

-F slapd-config-directory Specifies the slapd configuration directory. The default is /etc/openldap/slapd.d. If both -f and -F are specified, the config file will be read and converted to config directory format and written to the specified directory. If neither option is specified, slapd will attempt to read the default config directory before trying to use the default config file. If a valid config directory exists then the default config file is ignored. All of the slap tools that use the config options observe this same behavior.

source: slapd man page