org.apache.zookeeper.server.DatadirCleanupManager Java Examples
The following examples show how to use
org.apache.zookeeper.server.DatadirCleanupManager.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ZooKeeperStateServer.java From nifi with Apache License 2.0 | 6 votes |
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; }
Example #2
Source File: EmbededZKServer.java From Scribengin with GNU Affero General Public License v3.0 | 6 votes |
ZookeeperLaucher create(Properties zkProperties) throws ConfigException, IOException { QuorumPeerConfig zkConfig = new QuorumPeerConfig(); zkConfig.parseProperties(zkProperties); DatadirCleanupManager purgeMgr = new DatadirCleanupManager(zkConfig.getDataDir(), zkConfig.getDataLogDir(), zkConfig.getSnapRetainCount(), zkConfig.getPurgeInterval()); purgeMgr.start(); if (zkConfig.getServers().size() > 0) { return new QuorumPeerMainExt(zkConfig); } else { System.out .println("Either no config or no quorum defined in config, running in standalone mode"); // there is only server in the quorum -- run as standalone return new ZooKeeperServerMainExt(zkConfig); } }
Example #3
Source File: SpliceZoo.java From spliceengine with GNU Affero General Public License v3.0 | 6 votes |
@Override public void run() { DatadirCleanupManager purgeMgr = new DatadirCleanupManager(config .getDataDir(), config.getDataLogDir(), config .getSnapRetainCount(), config.getPurgeInterval()); purgeMgr.start(); SpliceLogUtils.trace(LOG, "Client Address: %s",config.getClientPortAddress()); try { peer.start(); SpliceLogUtils.trace(LOG, "Attempting to Join: %s",config.getClientPortAddress()); peer.join(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
Example #4
Source File: LocalZKServer.java From oryx with Apache License 2.0 | 4 votes |
/** * Starts Zookeeper. * * @throws IOException if an error occurs during initialization * @throws InterruptedException if an error occurs during initialization */ public synchronized void start() throws IOException, InterruptedException { log.info("Starting Zookeeper on port {}", port); dataDir = Files.createTempDirectory(LocalZKServer.class.getSimpleName()); dataDir.toFile().deleteOnExit(); QuorumPeerConfig quorumConfig = new QuorumPeerConfig(); try { quorumConfig.parseProperties(ConfigUtils.keyValueToProperties( "dataDir", dataDir.toAbsolutePath(), "clientPort", port )); } catch (QuorumPeerConfig.ConfigException e) { throw new IllegalArgumentException(e); } purgeManager = new DatadirCleanupManager(quorumConfig.getDataDir(), quorumConfig.getDataLogDir(), quorumConfig.getSnapRetainCount(), quorumConfig.getPurgeInterval()); purgeManager.start(); ServerConfig serverConfig = new ServerConfig(); serverConfig.readFrom(quorumConfig); zkServer = new ZooKeeperServer(); zkServer.setTickTime(serverConfig.getTickTime()); zkServer.setMinSessionTimeout(serverConfig.getMinSessionTimeout()); zkServer.setMaxSessionTimeout(serverConfig.getMaxSessionTimeout()); // These two ServerConfig methods returned String in 3.4.x and File in 3.5.x transactionLog = new FileTxnSnapLog(new File(serverConfig.getDataLogDir().toString()), new File(serverConfig.getDataDir().toString())); zkServer.setTxnLogFactory(transactionLog); connectionFactory = ServerCnxnFactory.createFactory(); connectionFactory.configure(serverConfig.getClientPortAddress(), serverConfig.getMaxClientCnxns()); connectionFactory.startup(zkServer); }