15.18. Trimming the Replication Changelog
The Directory Server changelog maintains a list of received and processed changes. It includes client changes and changes received from replication partners.
By default, Directory Server trims the changelog entries that are more than seven days old. However, you can modify this and configure:
- A maximum age of entries in the changelog in the
nsslapd-changelogmaxage
parameter. - The total number of records in the changelog in the
nsslapd-changelogmaxentries
parameter.
If you enabled at least one of these settings, Directory Server trims the changelog every 5 minutes by default (
nsslapd-changelogtrim-interval
).
All records and records created subsequently remain in the changelog until it is successfully replicated on all servers in the topology. If you must remove the supplier from the topology as described in Section 15.10.2, “Removing a Supplier from the Replication Topology”, then Directory Server trims all the updates of this supplier from changelogs on other servers.
15.18.1. Configuring Replication Changelog Trimming
By default, Directory Server trims the changelog entries that are more than seven days old. However, you can configure the time after which Directory Server can remove entries. You can also configure Directory Server to remove entries automatically when the number of entries exceeds a configured value.
Note
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:
- Configure change log trimming:
- To set a maximum age of changelog entries, enter:
# dsconf -D "cn=Directory Manager" ldap://server.example.com replication set-changelog --max-age "4w"
This command sets the maximum age to four weeks. The parameter supports the following units:s (S)
for secondsm (S)
for minutesh (H)
for hoursd (D)
for daysw (W)
for weeks
- To set a maximum number of entries, enter:
# dsconf -D "cn=Directory Manager" ldap://server.example.com replication set-changelog --max-entries "100000"
This command sets the maximum number of entries in the changelog to 100,000.
- By default, Directory Server trims the changelog every 5 minutes (300 seconds). To set a different interval, enter:
# dsconf -D "cn=Directory Manager" ldap://server.example.com 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.
Perform this procedure on the supplier.
Prerequisites
You enabled replication.
Procedure
- Optional: Display the size of the changelog:
# ls -lh /var/lib/dirsrv/slapd-instance_name/changelogdb/ total 159M rw------. 1 dirsrv dirsrv 159M Nov 21 04:01 a1cf5703-697a11ed-896ed7a0-04f329b5_637b3daf000000010000.db rw------. 1 dirsrv dirsrv 30 Nov 21 03:58 DBVERSION
This example shows that the /var/lib/dirsrv/slapd-instance_name/changelogdb/ directory contains only one changelog file with the size of 159M. - To be able to reset the parameters after reducing the changelog size, display and note the current values of the corresponding parameters:
# dsconf instance_name replication get-changelog dn: cn=changelog5,cn=config cn: changelog5 nsslapd-changelogdir: /var/lib/dirsrv/slapd-instance_name/changelogdb/ nsslapd-changelogmaxage: 7d nsslapd-changelogtrim-interval: 300 objectClass: top objectClass: nsChangelogConfig
If you do not see any specific attributes in the output, Directory Server uses their default values. - Temporarily, reduce trimming-related parameters:
# dsconf -D "cn=Directory Manager" ldap://server.example.com replication set-changelog --max-age "300s" --max-entries 500 --trim-interval 60
Important
For performance reasons, do not permanently use too short interval settings. - Wait until the time set in the
--trim-interval
parameter expires. - Compact the changelog to regain the disk space:
# dsconf -D "cn=Directory Manager" ldap://server.example.com backend compact-db --only-changelog
- Reset the changelog parameters to the values they had before you temporarily reduced them:
# dsconf -D "cn=Directory Manager" ldap://server.example.com replication set-changelog --max-age "7d" --max-entries 0 --trim-interval 300
Verification
- Display the size of the changelog:
# ls -lh /var/lib/dirsrv/slapd-instance_name/changelogdb/ total 14M rw------. 1 dirsrv dirsrv 14M Nov 21 05:08 a1cf5703-697a11ed-896ed7a0-04f329b5_637b3daf000000010000.db rw------. 1 dirsrv dirsrv 30 Nov 21 05:01 DBVERSION