use of org.apache.zookeeper.server.DatadirCleanupManager in project zookeeper by apache.
the class QuorumPeerMain method initializeAndRun.
protected void initializeAndRun(String[] args) throws ConfigException, IOException, AdminServerException {
QuorumPeerConfig config = new QuorumPeerConfig();
if (args.length == 1) {
config.parse(args[0]);
}
// Start and schedule the the purge task
DatadirCleanupManager purgeMgr = new DatadirCleanupManager(config.getDataDir(), config.getDataLogDir(), config.getSnapRetainCount(), config.getPurgeInterval());
purgeMgr.start();
if (args.length == 1 && config.isDistributed()) {
runFromConfig(config);
} else {
LOG.warn("Either no config or no quorum defined in config, running " + " in standalone mode");
// there is only server in the quorum -- run as standalone
ZooKeeperServerMain.main(args);
}
}
use of org.apache.zookeeper.server.DatadirCleanupManager in project nifi by apache.
the class ZooKeeperStateServer method start.
public synchronized void start() throws IOException {
if (started) {
return;
}
if (quorumPeerConfig.getPurgeInterval() > 0) {
datadirCleanupManager = new DatadirCleanupManager(quorumPeerConfig.getDataDir(), quorumPeerConfig.getDataLogDir(), quorumPeerConfig.getSnapRetainCount(), quorumPeerConfig.getPurgeInterval());
datadirCleanupManager.start();
}
if (quorumPeerConfig.isDistributed()) {
startDistributed();
} else {
startStandalone();
}
started = true;
}
use of org.apache.zookeeper.server.DatadirCleanupManager in project hbase by apache.
the class HQuorumPeer method runZKServer.
private static void runZKServer(QuorumPeerConfig zkConfig) throws IOException, AdminServer.AdminServerException {
/**
* Start and schedule the purge task
* autopurge.purgeInterval is 0 by default,so in fact the DatadirCleanupManager task will not
* be started to clean the logs by default. Config is recommended only for standalone server.
*/
DatadirCleanupManager purgeMgr = new DatadirCleanupManager(zkConfig.getDataDir(), zkConfig.getDataLogDir(), zkConfig.getSnapRetainCount(), zkConfig.getPurgeInterval());
purgeMgr.start();
if (zkConfig.isDistributed()) {
QuorumPeerMain qp = new QuorumPeerMain();
qp.runFromConfig(zkConfig);
} else {
ZooKeeperServerMain zk = new ZooKeeperServerMain();
ServerConfig serverConfig = new ServerConfig();
serverConfig.readFrom(zkConfig);
zk.runFromConfig(serverConfig);
}
}
Aggregations