Used: openldap-servers-2.4.23-34.el6_5.1.x86_64
Task: create script for crontab to create scheduled database full backup.
1) slapcat - create file in in the default format, Berkeley DB.
2) slapcat can be done while slapd running (if bdb/hdb database used).
3) To restore file after slapcat - must be used slapadd (not ldapadd).
4) slapcat/add doesn't require password.
5) slapadd can be done only when slapd stopped.
Example:
$ slapcat -f /etc/openldap/slapd.conf -b "dc=db_1" -l db_1_backup.ldif
$ slapadd -l db_1_backup.ldif
Instead of slapcat/add - let's took a look at ldapsearch/add:
1) ldapsearch - creates file with almost same information as slapcat;
2) ldapadd - can use file from ldapsearch, doesn't require slapd to be stopped;
3) ldapadd/search - requires password.
Example:
$ ldapsearch -D "cn=root,dc=db_1" -W -b "dc=db_1" "dc=db_1" -LLL > db_1_backup2.ldif
$ ldapadd -x -D "cn=root,dc=db_1" -W -f db_1_backup2.ldif
So - question is:
1) Am I missing anything in this tools description?
2) What else is difference between ldapadd/slapadd and ladpsearch/slapcat?
slapcatreturns entries in database (backend) order, which may or may not be well-defined.ldapsearchby default returns in the order the server replies, with OpenLDAP there is the choice of client-side sort (e.g.-S "") or server-side sort control (e.g.-E sss, if supported, and subject to some minor config & schema related bear traps). The spec says the search results may be in any order. An implementation could define a default order, most people assume the default is "parent before child", only OpenDS documents this, AFAIK. – mr.spuratic May 22 '15 at 16:48Database order is relatively meaningless given the possibility of subtree renames moving branches to new DIT locations.
– hyc May 24 '15 at 14:32