I'm using openldap 2.4.40, and i need to migrate my existing ldap database, configuration, and schema (basically everything ldap server related) to a new machine.
the problem is, I use cn=config configuration not the old slapd.conf file anymore.
The documentation provided by openldap and other 3rd party websites only helps for migrating slapd.conf LDAP server, not LDAP server with the newer cn=config configuration file.
and also I have new schema (attributetype and objectclass), is there a way to migrate these to a new machine as easily as possible?
I need other way than reconfiguring and adding my schema manually one by one to the new machine.
This will be done with the intention of turning off the old machine most likely.
TL;DR Is there any way to conveniently migrate LDAP database, schema, configuration from 1 LDAP Server to a new LDAP Server with the intention of turning off the old machine
Thank you.
*Posted the answer below
–
Julio
Best Answer
The solution :
So here's what I did to make this works.
Slapcat databases from the main server (There are 2 database that needs to be exported. I use the "-n" tag
This one will export all schema and cn=config and
This on will export all user data that you keep in LDAP.
delete the content of folder
use slapadd to import the configuration to the new server
-n 0 is for adding configuration back to LDAP
-n 1 is for adding database back to LDAP
*EDIT: Somehow those command won't work on my 2nd 3rd .... and so on try. So The proper command That I've verfied that it works are
and
Also Change permission in the /var/lib/ldap folder (chown and chmod) to openldap
if you have certificate for TLS connection. Copy the certificates and keys from old server to new server to the same exact location. change the permission on the places.
and it should be good to go.
Hopes this helps other people