Is it necessary to manually remove old Zookeeper Snapshot files in 4.16.01 per the ops guide?

We were reviewing the recurring maintenance in the Edge Private Cloud Operations Guide 4.16.01 and looking at how to implement the following procedure.

Removing Old Snapshot Files

Apache ZooKeeper also requires periodic maintenance to remove old snapshot files which accumulate as updates to the system are made. Instructions on how to clean up old snapshots can be found at

http://zookeeper.apache.org/doc/r3.1.2/zookeeperAdmin.html#sc_maintenance.

I stumbled across the following settings in the /opt/apigee/apigee-zookeeper/conf/zoo.cfg which seem to already handle snapshot retention.

# Be sure to read the maintenance section of the # administrator guide before turning on autopurge.
#
# http://zoo.apache.org/doc/current/zoo.dmin.html#sc_maintenance## The number of snapshots to retain in dataDir
autopurge.snapRetainCount=5
# Purge task interval in hours
# Set to "0" to disable auto purge feature
autopurge.purgeInterval=120

Does zookeeper now automatically handle snapshot retention with these configuration settings and therefore creating any custom scripts/routines is not longer necessary?

If so updates to the Operations guide should then indicate how to modify these settings if they are not sufficient for an implementation and also note that this is handled differently.

1 4 1,873
4 REPLIES 4

Not applicable

@David Ryan you can remove old snapshots manually if needed.

To remove snapshots, execute:

java -cp zookeeper.jar:log4j.jar:conf org.apache.zookeeper.server.PurgeTxnLog <dataDir> <snapDir> -n <count>

Thanks @Maudrit but that doesn't really answer my question. My original question was does zookeeper automatically handle snapshot retention or is it necessary to do this manually. The guides implies manually but the config "seems" to indicate otherwise. We trying to figure out if this really needs to be part of our maintenance or not.

Not applicable

Good spot @David Ryan indeed the default configuration should ensure for old snapshots to be automatically cleaned.

I sent a request internally to update our public documentation about this.

Doc updated here.

Thanks @Dario Bertini and @David Ryan