Search in sources :

Example 1 with DatadirCleanupManager

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);
    }
}
Also used : DatadirCleanupManager(org.apache.zookeeper.server.DatadirCleanupManager)

Example 2 with DatadirCleanupManager

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;
}
Also used : DatadirCleanupManager(org.apache.zookeeper.server.DatadirCleanupManager)

Example 3 with DatadirCleanupManager

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);
    }
}
Also used : DatadirCleanupManager(org.apache.zookeeper.server.DatadirCleanupManager) ServerConfig(org.apache.zookeeper.server.ServerConfig) QuorumPeerMain(org.apache.zookeeper.server.quorum.QuorumPeerMain) ZooKeeperServerMain(org.apache.zookeeper.server.ZooKeeperServerMain)

Aggregations

DatadirCleanupManager (org.apache.zookeeper.server.DatadirCleanupManager)3 ServerConfig (org.apache.zookeeper.server.ServerConfig)1 ZooKeeperServerMain (org.apache.zookeeper.server.ZooKeeperServerMain)1 QuorumPeerMain (org.apache.zookeeper.server.quorum.QuorumPeerMain)1