11.16. Forcing Replication Updates

When a Directory Server involved in replication is stopped for regular maintenance, it must be updated immediately when it comes back online. In the case of a supplier in a multi-master environment, the directory information needs to be updated by the other supplier in the multi-master set. In other cases, when a hub or a dedicated consumer is taken offline for maintenance, when they come back online, they need to be updated by the supplier server.
Even if the replication agreements are configured to keep the supplier and consumer servers always in sync, it is not sufficient to bring back up-to-date a server that has been offline for over five minutes. The Always Keep in Sync option means that the server generates a replication operation for every update operation it processes. However, if this replication operation cannot be performed because the consumer is offline, the operation times out after 10 minutes.

Note

The procedures described in this section can only be used when replication is already set up and consumers have been initialized.
To ensure that directory information will be synchronized immediately when a server comes back online, use either the Directory Server Console on the supplier server that holds the reference copy of the directory information or a customizable script.

11.16.1. Forcing Replication Updates from the Console

To ensure that replication updates are sent immediately when a consumer or a supplier in a multi-master replication configuration comes back online after a period of time, do the following on the supplier server that holds the most recent version of the directory information:
  1. In the Directory Server Console, click the Configuration tab, expand the Replication folder and database nodes, and select the replication agreement corresponding to the replica to update.
  2. Right click the replication agreement, and choose Send Updates Now from the drop-down list.
This initiates replication toward the server that holds the information that needs to be updated.

11.16.2. Forcing Replication Updates from the Command Line

From the consumer that requires updating, run a script that prompts the supplier to send replication updates immediately. This script is shown in Example 11.5, “replicate_now.sh Script Example”.
Copy this example script and name it something like replicate_now.sh. Substitute the actual values for the variables listed in Example 11.5, “replicate_now.sh Script Example”.

Note

This script must be run manually since it cannot be configured to run automatically as soon as the server, which was offline, comes back online again.

Example 11.5. replicate_now.sh Script Example

#!/bin/sh
SUP_HOST=supplier_hostname
SUP_PORT=supplier_portnumber
SUP_MGRDN=supplier_directoryManager
SUP_MGRPW=supplier_directoryManager_password
MY_HOST=consumer_hostname
MY_PORT=consumer_portnumber

ldapsearch -x -LLL -h ${SUP_HOST} -p ${SUP_PORT} -D "${SUP_MGRDN}" \
    -w ${SUP_MGRPW} -b "cn=mapping tree,cn=config" \
    "(&(objectclass=nsds5replicationagreement) \
        (nsDS5ReplicaHost=${MY_HOST}) \
        (nsDS5ReplicaPort=${MY_PORT}))" \
    -o ldif-wrap=no dn | grep "^dn: " > /tmp/$$.dn

cp /tmp/$$.dn /tmp/$$.off
cp /tmp/$$.dn /tmp/$$.on

cat >> /tmp/$$.off <<EOF
changetype: modify
replace: nsds5ReplicaEnabled
nsds5ReplicaEnabled: off
EOF

cat >> /tmp/$$.on<<EOF
changetype: modify
replace: nsds5ReplicaEnabled
nsds5ReplicaEnabled: on
EOF

ldapmodify -x -h ${SUP_HOST} -p ${SUP_PORT} -D "${SUP_MGRDN}" \
    -w ${SUP_MGRPW} -f /tmp/$$.off

sleep 1

ldapmodify -x -h ${SUP_HOST} -p ${SUP_PORT} -D "${SUP_MGRDN}" \
    -w ${SUP_MGRPW} -f /tmp/$$.on

rm -f /tmp/$$.*

Table 11.4. Replicate_Now Variables

Variable Definition
supplier_hostname Hostname of the supplier to contact for information on replication agreements with the current consumer.
supplier_portnumber LDAP port in use on the supplier.
supplier_directoryManager DN of the privileged Directory Manager user on the supplier.
supplier_directoryManager_password Password of the privileged Directory Manager user on the supplier.
consumer_hostname Hostname of the current consumer.
consumer_portnumber LDAP port in use on the consumer.
For the update operation to occur over an SSL connection, modify the ldapmodify command in the script with the appropriate parameters and values. For more information on the ldapmodify command, see Section 3.2, “Managing Entries from the Command Line”.