Menu Close

15.18. 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 supplier was removed from the topology, but the replica update vector (RUV) had not been removed.

15.18.1. Enabling Replication Changelog Trimming

You can configure Directory Server to remove entries from the changelog that are older than a specific time. You can also configure entries to be automatically removed if the number of entries exceeds a configured value. This section describes how to configure changelog trimming.


Red Hat recommends setting a maximum age instead of a maximum number of entries. The maximum age should match the replication purge delay set in the nsDS5ReplicaPurgeDelay parameter in the cn=replica,cn=suffixDN,cn=mapping tree,cn=config entry.
Perform this procedure on the supplier:
  1. Configure change log trimming:
    • To set a maximum age of changelog entries, enter:
      # dsconf -D "cn=Directory Manager" ldap:// replication set-changelog --max-age "4w"
      This command sets the maximum age to 4 weeks. The parameter supports the following units:
      • s for seconds
      • m for minutes
      • h for hours
      • d for days
      • w for weeks
    • To set a maximum number of entries, enter:
      # dsconf -D "cn=Directory Manager" ldap:// replication set-changelog --max-entries "100000"
      This command sets the maximum number of entries in the changelog to 100,000.
  2. By default, Directory Server trims the changelog every 5 minutes (300 seconds). To set a different interval, enter:
    # dsconf -D "cn=Directory Manager" ldap:// replication set-changelog --trim-interval 600
    This command sets the interval to 10 minutes (600 seconds).

15.18.2. Manually Reducing the Size of a Large Changelog

In certain situations, such as if replication changelog trimming was not enabled, the changelog can grow to an excessively large size. To fix this, you can reduce the changelog size manually.
This procedure describes how to trim the changelog of the dc=example,dc=com suffix. Perform this procedure on the supplier.
  1. Optional: Display the size of the changelog:
    1. Identify the back-end database of the dc=example,dc=com suffix:
      # dsconf -D "cn=Directory Manager" ldap:// backend suffix list
      dc=example,dc=com (userroot)
      The name in parentheses is the back-end database that stores the data of the corresponding suffix.
    2. Display the size of the changelog file of the userroot backend:
      # ls -lh /var/lib/dirsrv/slapd-instance_name/db/userroot/replication_changelog.db
      -rw-------. 1 dirsrv dirsrv 517M Jul  5 12:58 /var/lib/dirsrv/slapd-instance_name/db/userroot/replication_changelog.db
  2. To be able to reset the parameters after reducing the changelog size, display and note the current values of the corresponding parameters:
    # dsconf -D "cn=Directory Manager" ldap:// replication get-changelog --suffix "dc=example,dc=com"
    dn: cn=changelog,cn=userroot,cn=ldbm database,cn=plugins,cn=config
    cn: changelog
    nsslapd-changelogmaxage: 4w
    nsslapd-changelogmaxentries: 50000
    nsslapd-changelogtrim-interval: 300
    Parameters that are not displayed in the output are not set, and Directory Server uses their default values.
  3. Temporarily, reduce trimming-related parameters:
    # dsconf -D "cn=Directory Manager" ldap:// replication set-changelog --suffix "dc=example,dc=com" --max-age "300s" --max-entries 500 --trim-interval 60


    For performance reasons, do not permanently use too short interval settings.
  4. Wait until the time set in the --trim-interval parameter has expired.
  5. Compact the changelog to regain disk space:
    # dsconf -D "cn=Directory Manager" ldap:// backend compact-db --only-changelog
  6. Reset the changelog parameters to the values they had before you temporarily reduced them:
    # dsconf -D "cn=Directory Manager" ldap:// replication set-changelog --suffix "dc=example,dc=com" --max-age "4w" --max-entries 50000 --trim-interval 300
  7. Optional: Display the size of the changelog:
    # ls -lh /var/lib/dirsrv/slapd-instance_name/db/userroot/replication_changelog.db
    -rw-------. 1 dirsrv dirsrv 12M Jul  5 12:58 /var/lib/dirsrv/slapd-instance_name/db/userroot/replication_changelog.db