Previous     Contents     Index     Next     
iPlanet Directory Server Resource Kit 5.1 Tools Reference



Chapter 22   replcheck.pl


The replcheck.pl (replication check) tool is a Perl script which determines whether two or more replicated iPlanet Directory Servers are synchronized. It also reports which of the replicas is not currently up-to-date.



Note The script accesses internal attributes to report on the status of the replicated sub-tree. Therefore, it only can determine replication status for versions 5.x of the iPlanet Directory Server.



This chapter contains the following sections:



Command Usage

This tool is a Perl script that calls the PerLDAP libraries provided with the iPlanet Directory Server 5.x . By default, the first line of this script contains:

#!/usr/iplanet/servers/bin/slapd/admin/bin/perl

You should modify this first line of the script if you did not install iPlanet Directory Server in the default location on your machine. Or if you do not have Directory Server installed on your machine, modify this line to use the libraries installed in the unsupported directory of the iPlanet Directory Server Resource Kit:

#!/opt/iPlanet/unsupported/perLdap

In order to use the PerLDAP libraries you must build and install this tool according to the procedure described in "Building PerLDAP".


Syntax and Options

The replcheck.pl tool has the following syntax:

replcheck.pl [-w DirectoryManagerPassword ] -b baseDN host1 :port1 host2 :port2 ...

Where:

  • DirectoryManagerPassword is the password for "cn=Directory Manager" common to all replicas. If this password is not identical on all replicas, omit this option to be prompted interactively for each password.

  • baseDN is root of the subtree for which you wish to know the replication status.

  • hostn :portn is the hostname and port number for each of the replicated Directory Servers. If :port is omitted, port 389 is used by default. You must specify at least two hostn :portn pairs, and you may specify more for as many replicas as you wish.

The replcheck.pl -H command will display the usage help text that gives the command syntax.


Return Values

The replcheck.pl script returns 0 if all replicas are synchronized, and a positive integer otherwise. This allows the script to be used in other administrative scripts, for example to perform automated diagnostics.

If a replica is not in sync, the script will return its 0-based index (n -1) in the list of hosts on the command line. For example, if the replica on host2 is not up to date, the script will return 1.



Example and Sample Output



This example of the replcheck.pl tool shows the output containing the comparison of the internal attribute, called the replication update vector, that stores the replication status.

In this scenario, the sample command checks the replication status for the entire replicated tree under the "dc=siroe,dc=com" suffix, between a supplier replica hosted by master and a read-only consumer hosted by ro-hub.

$ perl -IinstallDir replcheck.pl -w password -b "dc=siroe,dc=com" \
                               master:1389 ro-hub:1389

Connected to master
Connected to ro-hub
-------------------------
Getting replication update vector for master replica of dc=siroe,dc=com
=> {replica 1 ldap://master.siroe.com:1389} 3c63e0b0000000010000
3c63f44b000100010000
=> {replica 3 ldap://ro-hub.siroe.com:1389}
=> {replicageneration} 3c63da79000000030000

Getting replication update vector for ro-hub replica of dc=siroe,dc=com
=> {replica 1 ldap://master.siroe.com:1389} 3c63e0b0000000010000
3c63f443000100010000
=> {replica 3 ldap://ro-hub.siroe.com:1389}
=> {replicageneration} 3c63da79000000030000

****
<{replica 1 ldap://master.siroe.com:1389} 3c63e0b0000000010000
3c63f44b000100010000>
----
<{replica 1 ldap://master.siroe.com:1389} 3c63e0b0000000010000
3c63f443000100010000>
****************
Replication Update Vector for ro-hub doesn't match with master
Servers are not in sync

$ echo $?    ## show return value
1

The first part of the output up to the **** separator displays the replication update vector in each replica. The second part compares all vector elements for each pair of replicas being considered and displays those that do not match. These elements encode information about the latest replication operations, and any differences in this pair of values indicates that the replicas are not up to date.

In this example the two elements differ slightly, and the tool displays the unmatched vector elements and human-readable explanation. Finally, the return value shows that the replcheck.pl tool reported that the second host on the command line, ro-hub, is out-of-date.

Previous     Contents     Index     Next     
Copyright 2002 Sun Microsystems, Inc.. All rights reserved.

Last Updated April 15, 2002