use of org.apache.bokkeeper.stats.datasketches.DataSketchesMetricsProvider in project pulsar by yahoo.
the class LocalBookkeeperEnsemble method runBookies.
private void runBookies(ServerConfiguration baseConf) throws Exception {
LOG.info("Starting Bookie(s)");
// Create Bookie Servers (B1, B2, B3)
bs = new BookieServer[numberOfBookies];
bsConfs = new ServerConfiguration[numberOfBookies];
statsProviders = new StatsProvider[numberOfBookies];
for (int i = 0; i < numberOfBookies; i++) {
File bkDataDir = isNotBlank(bkDataDirName) ? Files.createDirectories(Paths.get(bkDataDirName + Integer.toString(i))).toFile() : Files.createTempDirectory("bk" + Integer.toString(i) + "test").toFile();
if (this.clearOldData) {
cleanDirectory(bkDataDir);
}
bsConfs[i] = new ServerConfiguration(baseConf);
// override settings
bsConfs[i].setBookiePort(initialPort + i);
bsConfs[i].setZkServers("127.0.0.1:" + ZooKeeperDefaultPort);
bsConfs[i].setJournalDirName(bkDataDir.getPath());
bsConfs[i].setLedgerDirNames(new String[] { bkDataDir.getPath() });
bsConfs[i].setAllowLoopback(true);
bsConfs[i].setGcWaitTime(60000);
String statsFilePath = FileSystems.getDefault().getPath(bkDataDir.getAbsolutePath(), "bookie-stats.json").toString();
// Initialize Stats Provider
statsProviders[i] = new DataSketchesMetricsProvider();
bsConfs[i].setProperty("dataSketchesMetricsJsonFileReporter", statsFilePath);
statsProviders[i].start(bsConfs[i]);
StatsLogger statsLogger = statsProviders[i].getStatsLogger("");
bs[i] = new BookieServer(bsConfs[i], statsLogger);
bs[i].start();
LOG.debug("Local BK[{}] started (port: {}, data_directory: {})", i, initialPort + i, bkDataDir.getAbsolutePath());
}
}
Aggregations