LDAP Replication CentOS 6

LDAP Replication CentOS 6

In CentOS 6, LDAP as before has some basic issue with replication. For example, there’s a syncrepl utiltiy, and slurpd, however there is no manual, and nobody seems to know how to use this feature that apparently exists, so we have been forced to essentially build our own replication system. Here’s what we have:

LDAP1 – MASTER

LDAP2 – SLAVE

LDAP1 has a NFS share called “Replication” where the LDAP database from the master gets dumped to every 1 minute. In the scripts this is /Replication

LDAP2 connects to the replication share via /mnt/NFS and from there it deletes the local copy of the database, and replaces with the master database(containing any updates that occur)

Here’s the Master Script:

so basically we are using slapcat to view the database, in the specified LDAP domain, and dump to a file called ldap1-replication.ldif

Now let’s take a look at the LDAP Slave Script:

 

That’s what we have, obviously both scripts are run as a scheduled CRON Job. The master runs every 1 minute to dump the database, the Slave Restore Script runs every 2 minutes.

That’s it!

Hosted Linux Servers at www.zwiegnet.com/go