Symas OpenLDAP Knowledge Base

Using slapadd

slapadd

slapadd Man Page

Online Use: ⛔️

Syntax: slapadd <conf> (-b <baseDN> | -n <dbNum>) [-l <input-file.ldif>][-q][-w][-S <serverIdNum>]

  • The slapadd command is an offline-only tool for creating/restoring databases using an LDIF file for input

  • slapadd should NEVER be run while slapd is running

  • It is recommended that slapadd is not used to add new entries to an existing database, even if slapd is offline

  • Use ldapadd instead; this ensures that entries are passed through all overlays and modules before being written

Option Description
-q Enables quick operation. Uses fewer integrity checks. Use with known good data
-u Dry run, does not write to database
-o schema-check={yes|no} Enable/disable schema checking
-o value-check={yes|no} Enable/disable value checking
-w Write contextCSN value at end of load. Use ONLY when loading the first node in a cluster
-S <n> Use <n> as the serverId in entryCSNs
-c Continue loading if an error occurs (never use this with a production load)

These examples assume that the database is completely empty and the current working directory is /opt/symas/etc/openldap:

# Load a database with a known good LDIF file:
slapadd -f slapd.conf -b dc=example,dc=com -l database.ldif -q

# Load the first database with serverId 1 in an empty replication cluster:
slapadd -F slapd.d -b dc=example,dc=com -l database.ldif -q -w -S1

# Verify, but do not save data in an ldif, continue on errors and write error info to a log file; useful when migrating data from a different directory server
slapadd -f slapd.conf -b dc=example,dc=com -l database.ldif -c \
  -o schema-check=yes -o value-check=yes > validation.log 2>&1