15.16. Trimming the Replication Changelog

The Directory Server changelog manages a list of received and processed changes. It includes changes of clients ran on the server and additionally directory changes from other replication partners. Using the default settings, Directory Server does not automatically remove entries and the changelog grows infinitely. To control which entries are removed, use the following parameters:
  • nsslapd-changelogmaxage (recommended): Removes entries if they exceed the time set in this parameter.
  • nsslapd-changelogmaxentries: Removes the oldest entries if the total number of records exceed the value set in this parameter.
Any record and all subsequently created records remains in the changelog until it is successfully replicated to all servers in the topology. For example, this occurs in a situation when a Directory Server master was removed from the topology, but the replica update vector (RUV) had not been removed.

15.16.1. Enabling Replication Changelog Trimming

To enable replication changelog trimming and automatically remove entries that are older than 7 days (7d):
# ldapmodify -D "cn=Directory Manager" -W -p 389 -h server.example.com -x

dn: cn=changelog5,cn=config
changetype: modify
replace: nsslapd-changelogmaxage
nsslapd-changelogmaxage: 7d

Note

Red Hat recommends setting a maximum age in nsslapd-changelogmaxage instead of a maximum number of entries in nsslapd-changelogmaxentries. The time set in nsslapd-changelogmaxage should match the replication purge delay set in nsDS5ReplicaPurgeDelay. For details about nsDS5ReplicaPurgeDelay, see the parameter description in the Red Hat Directory Server Configuration, Command, and File Reference.

15.16.2. Manually Reducing the Size of a Large Changelog

When trimming the replication changelog was not enabled and the database grew to a large size, reduce the changelog size manually in the short term:
  1. To be able to reset the parameters after reducing the changelog size, display the current values of corresponding parameters. For example:
    # ldapsearch -x -D 'cn=Directory Manager' -W -b "cn=changelog5,cn=config" \
         nsslapd-changelogmaxage nsslapd-changelogcompactdb-interval \
         nsslapd-changelogtrim-interval nsslapd-changelogmaxage
    
    dn: cn=changelog5,cn=config
    nsslapd-changelogmaxage: 7d
    nsslapd-changelogcompactdb-interval: 2592000
    nsslapd-changelogtrim-interval: 300
    Parameters that are not displayed in the output are not set and Directory Server uses their default values. For the default values, see the parameter descriptions in the Red Hat Directory Server Configuration, Command, and File Reference.
  2. Reduce the following parameter's value temporarily:
    # ldapmodify -D "cn=Directory Manager" -W -p 389 -h server.example.com -x
    
    dn: cn=changelog5,cn=config
    changetype: modify
    replace: nsslapd-changelogmaxage
    nsslapd-changelogmaxage: 3d
    -
    replace: nsslapd-changelogtrim-interval
    nsslapd-changelogtrim-interval: 30
    -
    replace: nsslapd-changelogcompactdb-interval
    nsslapd-changelogcompactdb-interval: 300
    Using these settings, Directory Server removes changelog entries older than 3 days (nsslapd-changelogmaxage) within the next 30 seconds (nsslapd-changelogtrim-interval).
  3. Restart the Directory Server instance so that the new value of the nsslapd-changelogcompactdb-interval parameter takes effect:
    # systemctl restart dirsrv@instance
    After the next database update, the database is automatically compacted within the time interval set in the nsslapd-changelogcompactdb-interval parameter.
  4. Reset the updated parameters to their previous values. For example:
    # ldapmodify -D "cn=Directory Manager" -W -p 389 -h server.example.com -x
    
    dn: cn=changelog5,cn=config
    changetype: modify
    replace: nsslapd-changelogmaxage
    nsslapd-changelogmaxage: 7d
    -
    replace: nsslapd-changelogtrim-interval
    nsslapd-changelogtrim-interval: 300
    -
    replace: nsslapd-changelogcompactdb-interval
    nsslapd-changelogcompactdb-interval: 2592000

    Important

    For performance reasons, do not permanently use too short interval settings.
  5. Restart the Directory Server instance:
    # systemctl restart dirsrv@instance