Chapter 7. Migrating the database type from BDB to LMDB on an existing DS instance If you have an instance with the Berkeley Database (BDB) backend, you can change the BDB on this instance to Lightning Memory-Mapped Database (LMDB). Note Migration from BDB to LMDB is available only for instances with Directory Server version 12.5 or later. In mixed environment, consider the following limitations: You cannot use a backup to restore an instance with a different database type, because backup and restore formats are tied to this type. You cannot mix backends with different types on an instance. However, the following mix of implementations is possible: You can mix instances with different backend types on a host. You can mix replicas with different types in your replicated topology. Currently, you can use only the command line to migrate from BDB to LMDB or backwards. 7.1. Migrating the database type from BDB to LMDB using dsctl You can use the dsctl utility to automatically migrate the Berkeley Database (BDB) backend on an instance to the Lightning Memory-Mapped Database (LMDB). Prerequisites You have root permissions. Procedure Start the migration from BDB to LMDB: The command sets the nsslapd-backend-implement global configuration parameter to mdb and calculates the database size that you can adjust by setting the nsslapd-mdb-max-size parameter value. Remove the migration .ldif file and the old database: Note that you can migrate back from LMDB to BDB by using the dsctl instance_name dblib mdb2bdb command. Verification Check that the nsslapd-backend-implement configuration parameter value is set to mdb : Additional resources nsslapd-backend-implement mdb attributes 7.2. Manually migrating the database type from BDB to LMDB Use manual migration from the Berkeley Database (BDB) backend on an instance to the Lightning Memory-Mapped Database (LMDB) in the following cases: The migration by the dsctl utility cannot be performed. You want to set LMDB configuration attributes manually. Prerequisites You have root permissions. You have the Directory Manager password. Procedure Export all your databases to an LDIF file as described in Exporting data using the command line while the server is offline . Determine the LMDB database maximum size by clarifying the existing databases size and adding a safety margin of 20%. Skip this step if you migrate back from LMDB to BDB. Clarify the existing databases size: Add the safety margin of 20%: You require the maximum database size in the future steps. Change the database type to LMDB on the instance and restart the instance: When you migrate back from LMDB to BDB, set the --db-lib option to bdb . Set the LMDB maximum size to the value you calculated in the steps (2.16 GB) in bytes and restart the instance: The command sets the nsslapd-mdb-max-size configuration parameter value. Note Skip this step if you migrate back from LMDB to BDB. Import all databases from the LDIF file as described in Importing data using the command line while the server is offline . Verification Check that the nsslapd-backend-implement configuration parameter value is set to mdb :

Commands:
dsctl instance_name dblib bdb2mdb Backends importation 0.000000% (userroot) Backends importation 100%
dsctl instance_name dblib cleanup cleanup dbmapdir=/var/lib/dirsrv/slapd-instance_name/db dbhome=/dev/shm/slapd-instance_name dblib=mdb
dsconf -D "cn=Directory Manager" ldap://server.example.com backend config get | grep nsslapd-backend-implement Enter password for cn=Directory Manager on ldap://server.example.com: password nsslapd-backend-implement: mdb
du -hs /var/lib/dirsrv/slapd-instance_name/db/*/ 1.8GB
1.8 GB + 20% = 2.16 GB
dsconf instance_name backend config set --db-lib mdb Successfully updated database configuration dsctl instance_name restart Instance "instance_name" has been restarted
dsconf instance_name backend config set --mdb-max-size 2319282339 Successfully updated database configuration dsctl instance_name restart Instance "instance_name" has been restarted
dsconf -D "cn=Directory Manager" ldap://server.example.com backend config get | grep nsslapd-backend-implement Enter password for cn=Directory Manager on ldap://server.example.com: password nsslapd-backend-implement: mdb