[Date Prev][Date Next] [Chronological] [Thread] [Top]

How To Setup Mirroring in OpenLDAP 2.0 1/2



Title: Mirroring In OpenLDAP

How To Setup Mirroring in OpenLDAP 2.0 

by Tsahi Goren <gorent@encotone.com > and Ted Kandell <ted@cyber-wizard.com >

Table of Contents

Scope of this Document
1. Building a distributable RPM From The Source OpenLDAP source RPM
1.1. Get the source RPM
1.2. Install the source RPM
1.3. Generate the OpenLDAP mirroring RPM
2.  Configuring the master OpenLDAP servers for mirroring
2.1. Install the OpenLDAP RPMs
2.2  Copy the data from one server to the other
2.3  Configure both servers
2.4  Restart both OpenLDAP servers
Example Files
Example /usr/src/redhat/SOURCES/openldap-2.0.23-multimaster.patch
Example /usr/src/redhat/SPECS/openldap.spec
Example /etc/openldap/slapd.conf for server A:
Example /etc/openldap/slapd.conf for server B:

Scope of this Document

This document provides a guide for generating a set of OpenLDAP 2.0 servers on <>UNIX (and UNIX-like) systems that will automatically mirror changes made to one server to all the others . The document is aimed at experienced system administrators who are familiar with OpenLDAP and creating RPM packages.

This document is meant to be used in conjunction with other OpenLDAP information resources provided with the software package and on the project's extensive site (http://www.OpenLDAP.org/ ) on the World Wide Web. The site makes available a number of resources.

Note: This documentation applies to Linux distributions (particularly RedHat-like distributions) but it can be applied to other distributions with small modifications.


1. Building a Distributable RPM From The Source OpenLDAP Source RPM

1.1. Get the source RPM:

a. Go to http://www.rpmfind.net

b. In "Search" type: openldap

c. At your desired system on the 'Package' column click the *.html link

d. Click the Source RPM: Source RPM: openldap-{version}.src.rpm. on the right hand column to save the file to your desired directory. 

1.2. Install the source RPM: 

>From the command line in the directory in which you want to save the source RPM type:

rpm -i openldap-{version}.src.rpm

This will extract all the files you need in order to build the multimaster RPM to the directory: /usr/src/redhat

1.3. Generate the OpenLDAP Mirroring RPM: 

a.  Change directory to /usr/src/redhat/SPECS

b.  Type:

     rpm -bp openldap.spec

     This will create the directory: /usr/src/redhat/BUILD/openldap-{version}

c.  Create a multimaster replication patch:

     Note: You may skip this step and use the example patch file below:

  1. Copy the directory /usr/src/redhat/BUILD/openldap-{version} to /tmp by typing

    cp -rp /usr/src/redhat/BUILD/openldap-{version} /tmp

  2. Switch to the directory /tmp/openldap-{version}

  3. Edit the file configure.in:

  4. Uncomment (remove the 'dnl' word at he beginning of) all the lines that have something  to do with multimaster:

  5. Edit the file include/portable.h.in:

  6. Under:

    #undef SLAPD_MODULES

    add the following lines:

    /* define to support multimaster replication */
    #undef SLAPD_MULTIMASTER


  7. Create the patch by typing:

  8. diff -uNr /usr/src/redhat/BUILD/openldap-{version}/ /tmp/openldap-{version}/ > openldap-{version}-multimaster.patch

    Where {version} is substituted with your version of OpenLDAP, for example, 2.0.23

  9. Edit the file 'openldap-{version}-multimaster.patch' by removing the path:

    /tmp/

    from the lines:

    +++ /tmp/openldap-2.0.23/configure.in   Mon Apr 22 18:38:48 2002

    and

    +++ /tmp/openldap-2.0.23/include/portable.h.in   Mon Apr 22 18:48:05 2002

  10. Copy openldap-{version}-multimaster.patch to the directory:

  11. /usr/src/redhat/SOURCES

d.  Edit the file /usr/src/redhat/SPECS/openldap.spec:

     Note: You may skip this step and use the example spec file below :

e.  In the /usr/src/redhat/SPECS/ directory run the command:

     rpm -bb openldap.spec

     Note: This should take a while so don't worry :)

     This will create four packages in the directory: /usr/src/redhat/RPMS/i386

     Of these packages, only openldap-servers-multimaster-{version}.rpm
     should be affected by these changes.

f.  Now you are ready to install the following RPM packages found in the directory:

     /usr/src/redhat/RPMS/i386

     using the command:

     rpm -i {package name} or rpm -u {package name}


2. Configuring the OpenLDAP Master Servers for Mirroring

First of all, let us assume we we have two different Master-LDAP servers, A and B that need to mutually replicate changes from one to the other.

The steps you need to take are as follows:

2.1. Install the OpenLDAP RPM's:

The following applies both to servers A and B:

  1. Backup all your data:

  2. If you have a previous installation of openldap remove it by typing:

  3. rpm -e openldap-devel
    rpm -e openldap-clients
    rpm -e openldap-servers
    rpm -e openldap


  4. Install all openldap rpm's by typing:

  5. rpm -i --replacefiles openldap-{version}.i386.rpm
    rpm -i --replacefiles openldap-clients-{version}.i386.rpm
    rpm -i --replacefiles openldap-servers-multimaster-{version}.i386.rpm
    (optionally) rpm -i --replacefiles openldap-devel-{version}.i386.rpm

2.2. Copy the data from one server to the other:

2.3. Configure both servers:

The following applies to server A:
The following applies to server B:

There are a few key points to remember about this configuration:

2.4. Restart both OpenLDAP servers

Do this by typing on each machine:

service ldap restart

Thats it, it now should work!



Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more