Here is a sample .ldif file for meta-backend configuration:
dn: olcDatabase={3}meta,cn=config
objectClass: olcDatabaseConfig
objectClass: olcMetaConfig
olcDatabase: {3}meta
olcSuffix: dc=example,dc=com
olcDbOnErr: continue
olcDbCancel: abandon
olcDbTFSupport: no
structuralObjectClass: olcMetaConfig
dn: olcMetaSub={0}uri,olcDatabase={3}meta,cn=config
objectClass: olcMetaTargetConfig
olcMetaSub: {0}uri
olcDbURI: "ldap://localhost/ou=backend1,dc=example,dc=com"
olcDbRewrite: {0}suffixmassage "ou=backend1,dc=example,dc=com" "ou=backend1"
olcDbKeepalive: 0:0:0
olcDbBindTimeout: 100000
olcDbCancel: abandon
structuralObjectClass: olcMetaTargetConfig
To answer your second question here is how I created above. I followed this excellent blog post: https://blog.oddbit.com/post/2010-02-16-merging-directories-with-openldap-meta/
Here are my steps:
- Compile and install openldap under
/u01/app/openldap
- Created slapd-be1.conf, slapd-be2.conf and slapd-fe.conf
- Included above three files in
/u01/app/openldap/etc/openldap/slapd.conf
(I also commented out default database creation directive right below "MDB Database Definition"
- Created openldap database using this conf file:
$ u01/app/openldap/libexec/slapd -f /u01/app/openldap/etc/openldap/slapd.conf -h ldap:/// -F /u01/app/openldap/etc/slapd.d/
The above use slapd.conf and creates the database and it also creates structure under /u01/app/openldap/etc/slapd.d
, which can be used for OLC going forward.
5. Stop slapd
6. Start slapd and this time do not use slapd.conf
$ u01/app/openldap/libexec/slapd -h ldap:/// -F /u01/app/openldap/etc/slapd.d/
- Add data as per the blogpost
$ ldapadd -x -D cn=ldif-admin,ou=backend1 -W -f backend1.ldif
$ ldapadd -x -D cn=ldif-admin,ou=backend2 -W -f backend2.ldif
- Search for this added data using backend endpoint
$ dapsearch -x -b ou=backend1
- Search for this data using meta endpoint
$ ldapsearch -x -b dc=example,dc=com
- Dump LDAP config
$ slapcat -n 0 -l config.ldif -F /u01/app/openldap/etc/slapd.d
The above command would generate config.ldif containing configuration for the whole of LDAP. You'll see the meta configuration towards the end of the file. Going forward, you can use this syntax to create meta LDIF and import using OLC.
Hope the above helps.