Search in sources :

Example 1 with DataSketchesMetricsProvider

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());
    }
}
Also used : DataSketchesMetricsProvider(org.apache.bokkeeper.stats.datasketches.DataSketchesMetricsProvider) NullStatsLogger(org.apache.bookkeeper.stats.NullStatsLogger) StatsLogger(org.apache.bookkeeper.stats.StatsLogger) ServerConfiguration(org.apache.bookkeeper.conf.ServerConfiguration) BookieServer(org.apache.bookkeeper.proto.BookieServer) File(java.io.File)

Aggregations

File (java.io.File)1 DataSketchesMetricsProvider (org.apache.bokkeeper.stats.datasketches.DataSketchesMetricsProvider)1 ServerConfiguration (org.apache.bookkeeper.conf.ServerConfiguration)1 BookieServer (org.apache.bookkeeper.proto.BookieServer)1 NullStatsLogger (org.apache.bookkeeper.stats.NullStatsLogger)1 StatsLogger (org.apache.bookkeeper.stats.StatsLogger)1