Package org.apache.zookeeper.server
Class PurgeTxnLog
- java.lang.Object
-
- org.apache.zookeeper.server.PurgeTxnLog
-
@Public public class PurgeTxnLog extends java.lang.Object
this class is used to clean up the snapshot and data log dir's. This is usually run as a cronjob on the zookeeper server machine. Invocation of this class will clean up the datalogdir files and snapdir files keeping the last "-n" snapshot files and the corresponding logs.
-
-
Constructor Summary
Constructors Constructor Description PurgeTxnLog()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidmain(java.lang.String[] args)static voidpurge(java.io.File dataDir, java.io.File snapDir, int num)Purges the snapshot and logs keeping the last num snapshots and the corresponding logs.
-
-
-
Method Detail
-
purge
public static void purge(java.io.File dataDir, java.io.File snapDir, int num) throws java.io.IOExceptionPurges the snapshot and logs keeping the last num snapshots and the corresponding logs. If logs are rolling or a new snapshot is created during this process, these newest N snapshots or any data logs will be excluded from current purging cycle.- Parameters:
dataDir- the dir that has the logssnapDir- the dir that has the snapshotsnum- the number of snapshots to keep- Throws:
java.io.IOException
-
main
public static void main(java.lang.String[] args) throws java.io.IOException- Parameters:
args- dataLogDir [snapDir] -n count dataLogDir -- path to the txn log directory snapDir -- path to the snapshot directory count -- the number of old snaps/logs you want to keep, value should be greater than or equal to 3- Throws:
java.io.IOException
-
-