11.11. Removing a Supplier from the Replication Topology

Removing a supplier cleanly from the replication topology is more complex than simply removing the supplier entry. This is because every supplier in the topology stores information about other suppliers in the topology, and they retain that information even if a supplier is suddenly unavailable.
Information about the replication topology — all of the suppliers which are supplying updates to each other and other replicas within the same replication group — is contained in a set of metadata called the replica update vector (RUV). The RUV contains information about the supplier like its ID and URL, its latest change state number for changes made on the local server, and the CSN of the first change. Both suppliers and consumers store RUV information, and they use it to control replication updates.
To remove a supplier cleanly, this metadata must be removed along with the configuration entries.
  1. On the replica to remove, put the database into read-only mode to prevent any updates.
    [root@server ~]# ldapmodify -D "cn=directory manager" -W -x -p 389 -h dead-replica.example.com
    
    dn: cn=userRoot,cn=ldbm database,cn=plugins,cn=config
    changetype: modify
    replace: nsslapd-readonly
    nsslapd-readonly: on
    Allow a few minutes for the replica to flush all of its pending changes.
  2. On all other suppliers in the topology, delete the replication agreement with the replica to be removed.
    [root@server ~]# ldapmodify -D "cn=directory manager" -W -x -p 389 -h replica1.example.com
    
    dn: cn=Agmt_with_dead-replica,cn=replica,cn=dc\3Dexample\2Cdc\3Dcom,cn=mapping tree,cn=config
    changetype: delete
  3. On the replica to remove, get the replica ID for the replica to remove. This is in the nsds5replicaid attribute in the configuration entry.
    ldapsearch -xLLL -D "cn=directory manager" -W -s sub -b cn=config objectclass=nsds5replica nsds5replicaid
    
    dn: cn=dead-replica,cn=dc\3Dexample\2Cdc\3Dcom,cn=mapping tree,cn=config
    nsds5replicaid: 55
    ...
  4. On the replica to remove, remove all replication agreement entries and its own configuration entry.
    [root@server ~]# ldapmodify -D "cn=directory manager" -W -x -p 389 -h dead-replica.example.com
    
    dn: cn=to_replica1,cn=dead-replica,cn=dc\3Dexample\2Cdc\3Dcom,cn=mapping tree,cn=config
    changetype: delete
    ...
    
    dn: cn=to_replica2,cn=dead-replica,cn=dc\3Dexample\2Cdc\3Dcom,cn=mapping tree,cn=config
    changetype: delete
    
    dn: cn=dead-replica,cn=dc\3Dexample\2Cdc\3Dcom,cn=mapping tree,cn=config
    changetype: delete
  5. On one of the other servers in the topology, run the CLEANALLRUV replication task. This operation will be propagated to all the servers in the replication environment. The task name has the format CLEANALLRUVreplica#. For example, for a supplier with the replica ID 55, the task name is CLEANALLRUV55.
    ldapmodify -a -D "cn=directory manager" -W -p 389 -h server.example.com -x
    
    dn: cn=dead-replica,cn=dc\3Dexample\2Cdc\3Dcom,cn=mapping tree,cn=config
    changetype: modify
    replace: nsds5task
    nsds5task: CLEANALLRUV55
    It is possible to monitor the progress of the task on the other replicas by searching on the tombstone entry on each replica:
    ldapsearch -xLLL -D "cn=directory manager" -W -h remaining-replica.example.com -b "dc=example,dc=com" '(&(nsuniqueid=ffffffff-ffffffff-ffffffff-ffffffff)(objectclass=nstombstone))' nsds50ruv