org.apache.zookeeper.server
Class PurgeTxnLog
java.lang.Object
org.apache.zookeeper.server.PurgeTxnLog
public class PurgeTxnLog
- extends 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.
Method Summary |
static void |
main(String[] args)
|
static void |
purge(File dataDir,
File snapDir,
int num)
Purges the snapshot and logs keeping the last num snapshots and the
corresponding logs. |
PurgeTxnLog
public PurgeTxnLog()
purge
public static void purge(File dataDir,
File snapDir,
int num)
throws IOException
- Purges 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:
IOException
main
public static void main(String[] args)
throws 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:
IOException
Copyright © 2017 The Apache Software Foundation