Managing Replication and Referrals


eplication and referrals are both important mechanisms for extending your directory service beyond a single server configuration. This chapter describes how you can use both replication and referrals for your directory service. This chapter contains the following sections:

For conceptual information on how you can use replication and referrals in your directory service, see the Netscape Directory Server Deployment Guide.

 

Replication

Replication is the mechanism by which directory data is automatically copied from one directory server to another. Using replication, you can copy entire directory trees between servers. Updates of any kind--entry additions, modifications, or even deletions--are automatically mirrored to other directory servers using replication.

Note that all directory data is mastered in one and only one directory location. The server that masters directory data is called the supplier server. The supplier server can then propagate changes made to its directory data to other servers which are known as consumer servers.

There are two basic forms of replication available to you: supplier-initiated replication and consumer-initiated replication. Supplier-initiated replication allows you to configure a supplier server to push data to consumer server. Consumer-initiated replication allows you to configure consumer servers to pull directory data from supplier servers.

Directory servers use replication agreements to define replication. A replication agreement identifies the directory objects that are candidates for replication, the times during which replication can occur, the server to which the replicated data is to be pushed, or the server from which replicated data is to be pulled.

This chapter provides detailed information on how to setup replication agreements for two basic forms of replication: supplier-initiated replication and consumer-initiated replication. For more overview information on what replication is and how you might use it, see the Netscape Directory Server Deployment Guide.

 

Configuring a Server for Replication

The process of configuring a server for replication depends on whether the server is a supplier or consumer (or both) and the type of replication you are using: supplier-initiated replication or consumer-initiated replication.

 

Configuring Servers for Supplier-Initiated Replication

To configure servers for supplier-initiated replication, do the following:

  1. On the consumer server, configure a DN for the supplier to use to bind to the consumer and a corresponding password (if you are using normal authentication) or a certificate subject DN (if you are using SSL).

  2. On the supplier server, configure a change log directory and then restart the supplier server.

  3. Create a supplier-initiated replication agreement.

 

Configuring Servers for Consumer-Initiated Replication

To configure servers for supplier-initiated replication, do the following:

  1. On the supplier server, configure a change log directory and then restart the supplier server.

  2. On the supplier server, set up consumer access to the change log directory. This includes creating a DN and password for the consumer to use to bind to the supplier, as well as setting the access control instructions to allow the consumer to search and read the change log.

  3. Create a consumer-initiated replication agreement.

Before you can create replication agreements, you have to configure your server to either be a supplier or a consumer (or both). To do this, you must configure basic information about the server.

 

Configuring the Supplier DN

If you are using supplier-initiated replication, you must configure a supplier DN and password for your consumer servers before they can be updated with replicated directory entries. The Supplier DN is a special distinguished name that does not actually exist in your directory tree. Instead, it is identified in your slapd.conf Supplier DN parameter.

Supplier servers use the supplier DN to bind to this server. Entries supplied to this server from another server can only be updated if the LDAP client binds as the supplier DN; all other update operations for the supplied data will be referred to the supplier server that masters the directory data. It is therefore important that the only LDAP clients that bind to this server using the supplier DN are supplier servers.

You can configure the server to accept normal bind operations from the supplier, or you can configure the server to accept certificate-based authentication. The following sections describe how to configure these two methods of authentication.

 

Configuring the Server to Accept Normal Authentication

Configuring the supplier DN and password pair that this server will accept from the supplier server is fairly straightforward. Simply provide a DN in the Supplier DN field and a password in the password fields. For this kind of authentication, you should leave the Supplier SSL Clients box empty.

After changing the values in these fields, you must apply your changes and then restart your server.

 

Configuring the Server to Accept Certificate-Based Authentication

Certificate-based authentication requires that you use SSL for server to server communications, and that both your supplier and consumer servers are configured to use the appropriate certificate.

For replication purposes, you must tell your consumer server what certificate(s) correspond to the supplier DN that you have defined for the consumer server. To do this, identify the supplier DN for the local server in the Supplier DN field just as you would for the normal authentication case. Leave the password fields blank, and in the Supplier SSL Clients box, enter the subject DN of the certificate that the supplier server will use to bind to this server. If you have more than one server supplying entries to this consumer, enter a subject DN for each supplier server. Each DN should be placed on a separate line in the dialog box.

You can find the subject DN of the certificate used by a supplier server by going to the supplier server's manager and looking at the bottom of the Server Preferences | Server On/Off form.

Related Topics

 

Configuring the Change Log

Before a server can be a supplier of directory entries to consumer servers, you must configure a change log for the server. The change log is a special directory maintained by the supplier server that identifies the changes made to the server's primary directory tree. Special directory means that the change log is an actual directory tree that is contained in its own database for the sole purpose of tracking changes made to your directory data.

To configure a change log, you must identify the physical location where the change log will be stored and a directory suffix to use for the change log directory.

Related Topics

 

Providing Consumers Access to the Change Log

If you are using consumer-initiated replication, then you must do the following to allow a consumer to read the change log directory:

  1. Create a directory entry that can be used by your consumer servers to read your change log. This directory entry does not have to be created in your change log directory tree; it can instead be a normal entry in your primary directory tree.

  2. Provide an ACI statement at the root level of your change log tree that grants the user from step 1 read, search, and compare access to the entire change log tree. In addition, this ACI should grant full read, search, and compare privileges for the tree or subtree that the consumer server will retrieve from the supplier server.

For security reasons, you are recommended to not configure anonymous access for your change log directory tree. Also, you should grant only read, search, and compare access to the DN that your consumers will bind to your supplier with; do not provide any form of write or delete access to this tree.

Finally, for logging and auditing purposes, you may want to configure a different directory entry to be used by each consumer server for this purpose. This will allow you to track which consumer is binding to your server and when.

Related Topics

 

Creating Replication Agreements

To create either supplier-initiated or consumer-initiated replication agreements, you use the Replication Settings java applet. You access this applet from Replica Config | Configure Replication Agreements.

This form has two distinct areas:

Related Topics

 

Managing Supplier-Initiated Agreements

You manage supplier-initiated agreements from the Supplier Initiated Agreements area of the Replication Settings applet. From this area, you have access to the following buttons:

 

Creating a Supplier-Initiated Agreement

To create a supplier-initiated replication agreement:

  1. On the consumer server:

  2. On the supplier server:

 

Adding and Editing a Replication Agreement

To add a consumer of supplier-initiated agreements, go to Replica Config | Configure Replication Agreements on the supplier server. Under Supplier Initiated Agreements, click Add Consumer. To edit an existing agreement, highlight the agreement.

The Replication Editor now appears.

In the Nickname field at the top of the editor, enter a unique name representative of this agreement.

You now have three tabs that you use to add a new consumer: Destination, Content, and Schedule. A fourth tab, Status, allows you to track replication activity.

 

The Destination Tab

Use the Destination tab when you are setting up replication to identify the consumer to which you will replicate directory entries. Do the following:

 

The Content Tab

Use the Content tab when you are setting up replication to identify the portions of your directory tree that you are replicating to your consumer server. In this tab, you can do the following:

Related Topic

 

The Schedule Tab

Use the Schedule tab when you are setting up replication to identify the time of day and day of week when replication can occur. Any replication activity that is occurring when the specified time interval ends will be completed, but no new replication processes will be started outside the specified replication interval.

Select "Always keep directories in sync" if you do not want the replication window to ever close.

 

The Status Tab

The Status tab allows you to see a log of replication activity. Use the Update button to refresh the display of this log.

 

Managing Consumer-Initiated Agreements

You manage consumer-initiated agreements from the Consumer Initiated Agreements area of the Replication Settings applet. From this area, you have access to the following buttons:

 

Creating a Consumer-Initiated Agreement

To create a consumer-initiated replication agreement:

  1. On the supplier server:

  2. On the consumer server:

 

Adding and Editing a Replication Agreement

To add a consumer of supplier-initiated agreements, go to Replica Config | Configure Replication Agreements on the supplier server. Under Supplier Initiated Agreements, click Add Consumer. To edit an existing agreement, highlight the agreement.

The Replication Editor now appears.

In the Nickname field at the top of the editor, enter a name or short description that is representative of this agreement.

You now have three tabs that you use to add a new consumer: Source, Content, and Schedule. A fourth tab, Status, allows you to track replication activity.

 

The Source Tab

Use the Source tab when you are setting up replication to identify the supplier server from which your consumer will obtain directory entries. Do the following:

 

The Content Tab

Use the Content tab when you are setting up replication to identify the tree or subtree that you are obtaining from the supplier server. In this tab, you can do the following:

Related Topics

 

The Schedule Tab

Use the Schedule tab when you are setting up replication to identify the time of day and day of week when replication can occur. Any replication activity that is occurring when the specified time interval ends will be completed, but no new replication processes will be started outside the specified replication interval.

Select "Always keep directories in sync" if you do not want the replication window to ever close.

 

The Status Tab

The Status tab allows you to see a log of replication activity. Use the Update button to refresh the display of this log.

 

Initializing Consumers

After you have created a replication agreement, you must initialize the consumer. That is, you must physically move directory data from the supplier server to the consumer server so that changes can be replayed to consumer servers.

There are two ways that a consumer can be initialized:

This section first describes consumer initialization in detail. It then describes the two types of consumer creation processes.

 

When to Initialize a Consumer

Consumer initialization involves copying the replicated directory entries from the supplier server to the consumer server. When these entries are placed on the consumer server, the appropriate copiedFrom attribute must also be placed on the replicated tree (see "Supplier-Initiated Replication Algorithm" or "Consumer-Initiated Replication Algorithm" for details).

Once the tree has been physically placed on the consumer, the supplier server can begin begin replaying update operations to the consumer server. In addition, any attempts to modify data on the consumer that is owned by the supplier are referred to the supplier server.

Under normal operations, the consumer should not ever have to be initialized again. However, there are several major events that can require a reinitialization of the consumer server:


		Inconsistency detected while replaying change <n>, 
entry <DN>, to replica <host>:<port>/<DN>
This message will also indicate whether the inconsistency could be repaired.

The process that you use to initialize or reinitialize a consumer differs depending on the type of consumer creation that you are using. See "Online Consumer Creation" (next) or "Manual Consumer Creation" for more information.

 

Online Consumer Creation

Online consumer creation is the easiest way to initialize or reinitialize a consumer. However, this process can be very time consuming, and for large databases you may find that manual consumer creation is a more appropriate approach (refer to "Manual Consumer Creation" for more information).

Online consumer creation works by moving data from the supplier to the consumer server over LDAP. That is, the replicated information is placed on the consumer server using LDAP add operations. This is exactly the mechanism used by the supplier server to synchronize a consumer, and it requires very little action on your part to succeed.

Before using online consumer creation, consider the performance implications of this method of consumer initialization. On a reasonably fast single processor (such as an Intel Pentium II or a Sun Sparc Ultra 1), you can expect online consumer creation to proceed at the following rates:

 

When You Should Use Online Consumer Creation

Essentially, you should always use online consumer creation unless you find the time that it takes to complete this operation objectionable.

In addition, you should always use online consumer creation whenever your consumer server contains a directory tree that is mastered by more than one server. In this case, the manual creation process offers no performance advantage over online consumer creation.

 

How to Use Online Consumer Creation

To use online consumer creation, do the following:

  1. Create a replication agreement in Replication | Configure Replication Agreements.

    For details on creating replication agreements, see "Creating a Supplier- Initiated Agreement" or "Creating a Consumer-Initiated Agreement".

  2. Highlight the appropriate replication agreement.

  3. Click the Initialize Consumer button, and then click Initialize in the confirmation box.

Online consumer creation begins immediately. You can find out if online consumer creation is finished by clicking the status tab. If online consumer creation is in progress, the status shows that a replica is being initialized. To update this window, you must click the Update button. When online consumer creation is finished, the status is changed to reflect this.

Note that you can configure your server to automatically reinitialize a consumer. To do this, place the following line in the slapd.conf file of either the supplier server (for supplier-initiated replication) or the consumer server (for consumer-initiated replication):


	orcauto on

The orcauto slapd.conf parameter causes the consumer to be reinitialized if a version number mismatch occurs between the supplier server's database and the replicated entries, or if the supplier is unable to replay changes to the consumer due to problems with the change log (see "When to Initialize a Consumer" for more information).

 

Manual Consumer Creation

Manual consumer creation is the fastest method of consumer initialization for sites that are replicating very large numbers of entries. However, the manual process is significantly more complicated than the online manual creation process.

You should use the manual process whenever you find that the online process is inappropriate due to performance concerns. Also, you should never use the manual process if your consumer server contains directory data that is mastered by more than one directory server. That is, use the manual process only if your entire consumer server's database is supplied to it from a single supplier server. For more information, see "How to Perform Manual Consumer Creation".

For information on consumer initialization, see "Initializing Consumers". For information on the online consumer creation process, see "Online Consumer Creation".

 

How to Perform Manual Consumer Creation

To manually initialize or reinitialize a server:

  1. Create a replication agreement as described in "Creating a Supplier-Initiated Agreement" or "Creating a Consumer-Initiated Agreement".

  2. On the supplier server, convert the local directory tree that you want to replicate to LDIF (see below).

  3. Import the LDIF file to the consumer server (see below).

To convert the local tree to LDIF, do the following on the supplier server:

  1. Put your supplier's database in read-only mode to ensure the consistency of the LDIF file you are going to create.

    For information on how to put your database into read-only mode, see "Placing Your Database in Read-Only Mode". Note that this process requires a server restart.

  2. From the Server Manager, go to Replication | Manual Consumer Initialization.

  3. In the Copy Subtree field, enter the distinguished name of the subtree to be converted to LDIF.

  4. In the To LDIF File field, enter the name of the LDIF file to be created. The file you specify will be placed in the NSHOME\slapd-<serverId>\ldif directory; you cannot specify a full file path in this field.

  5. Click OK.

  6. Take your database out of read-only mode. Again, this process requires a server restart.

To import the LDIF file to the consumer server:

  1. Using FTP or some other mechanism, transfer the LDIF statements created by the supplier server to your consumer server. Remember that LDIF files are ASCII files, so if you are transferring the file between systems with different end-of-line (EOL) characters (such as between Windows NT and Unix), be sure to perform an ASCII transfer so that the EOL characters are converted appropriately.

  2. Create your consumer server's database from the LDIF file by using either the Database Management | Import form, or the ns-slapd ldif2ldbm command-line utility.

    For more information, see "Importing LDIF Using the Server Manager", or "Importing LDIF from the Command Line".

It is important to note that you should never use this manual consumer creation process if your supplier server is mastering only part of the tree contained on the consumer server. This is because this process erases the consumer server's database which wipes out the rest of the consumer's tree.

If your consumer server contains data that is also mastered either by itself or by some other supplier server, then use the online consumer creation process (for details, see "Online Consumer Creation"). While it is possible to manually import this LDIF file, you must do so using ldapmodify which offers no performance improvement over online consumer creation because both mechanisms are adding entries over LDAP.

If for some reason you decide that you must manually initialize a consumer that contains data mastered by some other server than your supplier server, make sure you do the following:

 

Supplier-Initiated Replication Algorithm

If you are using supplier-initiated replication, it is the responsibility of the supplier server to determine when its consumer servers are to be updated. This process occurs as follows:

  1. Based on a schedule that you set, the supplier server determines that it is time to synchronize a consumer. The directory server identifies those subtrees that are replicated and the servers to which it is supplying those trees by using directory entries contained in the Machine data tree. Each consumer server is identified by a separate machine data entry. Part of each such entry is an identification of the root point of the replicated tree and a schedule indicating when the consumer should be updated.

  2. The supplier server binds to the consumer server using the supplier DN and password that you provide. The supplier must use this special DN for the bind or all updates to the replicated tree will be referred back to the supplier server.

    You use the Replica Config | Configure Replication Agreements form to configure the supplier DN for a consumer server.

  3. Each replicated tree contained on a consumer server should include a copiedFrom attribute that identifies the supplier of the subtree. This attribute is maintained by the replication subsystem. The supplier server examines the copiedFrom attribute in the replicated subtree's root point to ensure that no other supplier is identified by this attribute.

    If no such attribute exists for the subtree, the supplier server:

    1. Writes the attribute to the replicated root point along with the appropriate attribute value.

    2. Resets the consumer version identification to zero.

    3. Aborts and immediately retries the synchronization.

    If the copiedFrom attribute identifies some server (server B) other than the current supplier (server A), the supplier (server A) aborts synchronization and returns an error. This prevents any one replicated entry on the consumer from having multiple suppliers.

    If the copiedFrom attribute is set correctly, the supplier compares version identification on the replicated tree against the supplier's change log to determine whether the replicated tree needs to be updated. The change log is a log of all the changes made to the supplier's entries. Among other things, this log contains version identification used for synchronization purposes.

  4. If no changes are required, the supplier terminates synchronization normally. Otherwise, the supplier updates and/or deletes all appropriate entries on the consumer as indicated by the change log. The supplier also records the last update number applied to the replica and sets the copiedFrom attribute at the top of the replicated tree on the consumer server. This identifies the tree as being a replica and, more importantly, identifies the supplier server as the master of the information in that tree.

  5. The supplier exits synchronization normally.

 

Consumer-Initiated Replication Algorithm

If you are using consumer-initiated replication, it is the responsibility of the consumer server to request updates from the supplier server. This process occurs as follows:

  1. Based on a schedule that you set (which is stored in the consumer server's machine data tree), the consumer server determines that it wants to be updated.

  2. The consumer server obtains from its own machine data tree the location of each of its own directory trees that are supplied to it from another server. The consumer then examines the root point of each of these trees to make sure that a copiedFrom attribute is set on the root point.

    If no copiedFrom attribute exists on the tree, the consumer server adds one so that all write operations are appropriately referred to the supplier server.

  3. The consumer server binds to the supplier server and searches the supplier's change log directory to see if the last update that the consumer has recorded in its directory is still contained in the supplier's directory. If it does not, then the consumer has no way of knowing what other changes may have occurred on the supplier since the last time that the consumer was updated. In this situation, the consumer simply reinitializes itself from the supplier server.

  4. If the consumer's last update is still contained in the supplier's change log, then the consumer determines if any changes occurred on the supplier server that must be made to the consumer server's directory. If no changes are required, the consumer terminates synchronization normally. Otherwise, the consumer updates and/or deletes all appropriate entries in its directory tree as indicated by the change log. The consumer sets the appropriate version identification at the same time.

  5. The consumer exits synchronization normally.

 

Machine data

By default, your database actually contains two distinct directory trees. The first is the tree that the server uses to manage your entries. This tree is represented by the Suffix you create when you initially install a directory server instance.

A second tree is also created when you install your directory server. This tree is used to contain machine data. The machine data tree contains two top-level entries that identify the local server. The first entry uses the NetscapeMachineData object class to identify the domain components of the machine on which the server is installed. The second entry uses the LDAPServer object class to identify the port on which the LDAP server is listening.

The machine data tree also contains zero or more entries that identify consumer or supplier servers. On the suppler server, the machine data tree contains an entry for each consumer server to which the server replicates data. These consumer server entries use object class LDAPReplica. On the consumer servers, the machine data tree contains an entry for each supplier server. The suppler server entries use object class
cirReplicaSource.

See Appendix A, "Object Classes" for information on the NetscapeMachineData, LDAPServer, LDAPReplica, cirReplicaSource object classes.

The suffix for the machine data directory tree is

dc=<serverID>, dc=<domain>, dc=<domain_type>

For example, if your directory server is running on directory.airius.com, then the machine data suffix is

dc=directory, dc=airius, dc=com

 

Managing Referrals

Referrals are a redirection mechanism that are supported by the LDAP protocol. There are several reasons why a directory server might return a referral:

For more information on how referrals are used by LDAP and clients and servers, and for information on the reasons why you might want to use referrals, see the Planning Referrals chapter in the Netscape Directory Server Deployment Guide.

 

Creating and Changing Smart Referrals

As of LDAP v3, you can configure your directory server to use smart referrals. Essentially, smart referrals allow you to map a directory entry or directory tree to a specific LDAP URL. Thus, if a client requests a directory entry such as uid=bjensen, ou=people, o=airius.com you can refer the client to a specific server, or a specific entry on a specific server. As a result, for the above DN you could refer the client to the entry cn=babs jensen, o=people, l=europe, o=airius.com on the server, directory.europe.airius.com.

You create and manage smart referrals by using ldapmodify (for information on ldapmodify, see "Modifying Entries Using ldapmodify").

To create a smart referral, create the relevant directory entry with the Referral object class. This object class allows a single attribute: ref. The ref attribute is expected to contain an LDAP URL.

For example, to return a smart referral for the entry uid=bjensen, ou=people, o=airius.com, create the entry as follows:


	dn: uid=bjensen, ou=people, o=airius.com
objectclass: top
objectclass: referral
ref: ldap://directory.europe.airius.com/cn=babs jensen, o=people,
l=europe, o=airius.com
Note that you can use the -m parameter with the command-line utilities to cause the server to not return the smart referral. For information on the -m parameter, see "Additional ldapmodify Parameters".

For more information on smart referrals, see Chapter 8 of the Netscape Directory Server Deployment Guide. For information on LDAP URLs, see Appendix C, "LDAP URLs."