Listing Indexes#

Listing standard indexes#

$ ldapsearch -x -D "cn=Directory Manager" -w ``\ ``Secret.123`` -b “cn=``ca,cn=ldbm database,cn=plugins,cn=config" "(objectClass=nsIndex)"
dn: cn=issuedby,cn=index,cn=ca,cn=ldbm database,cn=plugins,cn=config
nsIndexType: eq
nsSystemIndex: false
objectClass: top
objectClass: nsIndex
cn: issuedby
...

Listing VLV indexes#

$ ldapsearch -x -D "cn=Directory Manager" -w ``\ ``Secret.123`` -b “cn=``ca,cn=ldbm database,cn=plugins,cn=config" "(objectClass=vlvSearch)"
dn: cn=allCerts-pki-tomcat,cn=ca,cn=ldbm database,cn=plugins,cn=config
objectClass: top
objectClass: vlvSearch
vlvFilter: (certstatus=*)
vlvScope: 1
vlvBase: ou=certificateRepository,ou=ca,dc=ca,dc=example,dc=com
cn: allCerts-pki-tomcat
...
$ ldapsearch -x -D "cn=Directory Manager" -w ``\ ``Secret.123`` -b “cn=``ca,cn=ldbm database,cn=plugins,cn=config" "(objectClass=vlvIndex)"
dn: cn=allCerts-pki-tomcatIndex,cn=allCerts-pki-tomcat,cn=ca,cn=ldbm database,cn=plugins,cn=config
vlvSort: serialno
objectClass: top
objectClass: vlvIndex
cn: allCerts-pki-tomcatIndex
vlvEnabled: 1
vlvUses: 0
...

Creating Indexes#

Creating standard indexes#

Prepare the standard indexes in a file:

$ /bin/cp /usr/share/pki/ca/conf/index.ldif .
$ sed -i "s/{database}/ca/" index.ldif

For example:

dn: cn=issuedby,cn=index,cn=ca,cn=ldbm database, cn=plugins, cn=config
objectClass: top
objectClass: nsIndex
nsindexType: eq
nsSystemindex: false
cn: issuedby

Then add the indexes:

$ ldapadd -x -D "cn=Directory Manager" -w ``\ ``Secret.123`` -f index.ldif``

Creating VLV indexes#

Prepare the VLV indexes in a file:

$ /bin/cp /usr/share/pki/ca/conf/vlv.ldif .
$ sed -i "s/{instanceId}/pki-tomcat/g" vlv.ldif
$ sed -i "s/{database}/ca/g" vlv.ldif
$ sed -i "s/{rootSuffix}/dc=ca,dc=example,dc=com/" vlv.ldif

For example:

dn: cn=allCerts-pki-tomcat, cn=ca, cn=ldbm database, cn=plugins, cn=config
objectClass: top
objectClass: vlvSearch
cn: allCerts-pki-tomcat
vlvBase: ou=certificateRepository,ou=ca,dc=ca,dc=example,dc=com
vlvScope: 1
vlvFilter: (certstatus=*)
dn: cn=allCerts-pki-tomcatIndex, cn=allCerts-pki-tomcat, cn=ca, cn=ldbm database, cn=plugins, cn=config
objectClass: top
objectClass: vlvIndex
cn: allCerts-pki-tomcatIndex
vlvSort: serialno

Then add the indexes:

$ ldapadd -x -D "cn=Directory Manager" -w ``\ ``Secret.123`` -f vlv.ldif``

Reindexing Database#

If any of the indexes in a database is changed, the database needs to be reindexed:

Rebuild standard indexes#

Using db2index.pl#

To reindex the database offline:

$ systemctl stop dirsrv@pki-tomcat.service
$ db2index.pl -Z ``\ ``pki-tomcat`` -D “cn=Directory Manager” -w \ ``Secret.123`` -n \ ``ca
$ systemctl start dirsrv@pki-tomcat.service

Using reindex task#

To reindex the database while running, execute the following command:

$ /bin/cp /usr/share/pki/ca/conf/indextasks.ldif .
$ sed -i "s/{database}/ca/" indextasks.ldif
$ ldapadd -x -D "cn=Directory Manager" -w ``\ ``Secret.123`` -f indextasks.ldif``

Wait until the reindex task is done:

$ ldapsearch -x -D "cn=Directory Manager" -w ``\ ``Secret.123`` -b “cn=index1160589770,cn=index,cn=tasks,cn=config” -s base``
dn: cn=index1160589770,cn=index,cn=tasks,cn=config
nsTaskExitCode: 0

Rebuilding VLV indexes#

Using vlvindex#

To reindex the database offline:

$ systemctl stop dirsrv@pki-tomcat.service
$ vlvindex -Z ``\ ``pki-tomcat`` -n \ ``ca`` -T allCerts-\ ``pki-tomcat
...
$ systemctl start dirsrv@pki-tomcat.service

Using reindex task#

To reindex the database while running, execute the following command:

$ /bin/cp /usr/share/pki/ca/conf/vlvtasks.ldif .
$ sed -i "s/{instanceId}/pki-tomcat/g" vlvtasks.ldif
$ sed -i "s/{database}/ca/g" vlvtasks.ldif
$ ldapadd -x -D "cn=Directory Manager" -w ``\ ``Secret.123`` -f vlvtasks.ldif``

Wait until the reindex task is done:

$ ldapsearch -x -D "cn=Directory Manager" -w ``\ ``Secret.123`` -b “cn=index1160589769,cn=index,cn=tasks,cn=config” -s base``
dn: cn=index1160589769,cn=index,cn=tasks,cn=config
nsTaskExitCode: 0

References#