Search in sources :

Example 1 with BBoxDBConfiguration

use of org.bboxdb.misc.BBoxDBConfiguration in project bboxdb by jnidzwetzki.

the class TestDistributedInstanceManager method testWriteSystemInfo.

/**
 * Test write the system info
 */
@Test(timeout = 60000)
public void testWriteSystemInfo() {
    final BBoxDBInstance instance1 = new BBoxDBInstance("node6:5050");
    final ZookeeperClient zookeeperClient1 = getNewZookeeperClient(instance1);
    BBoxDBInstanceManager.getInstance().startMembershipObserver(zookeeperClient1);
    final List<BBoxDBInstance> distributedInstances = BBoxDBInstanceManager.getInstance().getInstances();
    Assert.assertEquals(1, distributedInstances.size());
    final BBoxDBInstance instance = distributedInstances.get(0);
    Assert.assertEquals(SystemInfo.getAvailableMemory(), instance.getMemory());
    Assert.assertEquals(SystemInfo.getCPUCores(), instance.getCpuCores());
    final BBoxDBConfiguration bboxDBConfiguration = BBoxDBConfigurationManager.getConfiguration();
    final List<String> directories = bboxDBConfiguration.getStorageDirectories();
    Assert.assertEquals(directories.size(), instance.getNumberOfStorages());
    Assert.assertEquals(directories.size(), instance.getAllTotalSpaceLocations().size());
    Assert.assertEquals(directories.size(), instance.getAllFreeSpaceLocations().size());
    for (final String directory : directories) {
        final File path = new File(directory);
        Assert.assertEquals(SystemInfo.getFreeDiskspace(path), (long) instance.getAllFreeSpaceLocations().get(directory), 1000000);
        Assert.assertEquals(SystemInfo.getTotalDiskspace(path), (long) instance.getAllTotalSpaceLocations().get(directory), 1000000);
    }
    zookeeperClient1.shutdown();
}
Also used : ZookeeperClient(org.bboxdb.distribution.zookeeper.ZookeeperClient) BBoxDBConfiguration(org.bboxdb.misc.BBoxDBConfiguration) BBoxDBInstance(org.bboxdb.distribution.membership.BBoxDBInstance) File(java.io.File) Test(org.junit.Test)

Example 2 with BBoxDBConfiguration

use of org.bboxdb.misc.BBoxDBConfiguration in project bboxdb by jnidzwetzki.

the class ZookeeperClientFactory method getZookeeperClient.

/**
 * Returns a new instance of the zookeeper client
 * @return
 */
public static synchronized ZookeeperClient getZookeeperClient() {
    if (client == null) {
        final BBoxDBConfiguration bboxdbConfiguration = BBoxDBConfigurationManager.getConfiguration();
        final Collection<String> zookeepernodes = bboxdbConfiguration.getZookeepernodes();
        final String clustername = bboxdbConfiguration.getClustername();
        client = new ZookeeperClient(zookeepernodes, clustername);
    }
    if (!client.isConnected()) {
        client.init();
    }
    return client;
}
Also used : BBoxDBConfiguration(org.bboxdb.misc.BBoxDBConfiguration)

Example 3 with BBoxDBConfiguration

use of org.bboxdb.misc.BBoxDBConfiguration in project bboxdb by jnidzwetzki.

the class SSTableServiceRunnable method openFacades.

/**
 * Open the facades
 *
 * @param newTableWriter
 * @param newFacades
 * @throws StorageManagerException
 */
private void openFacades(final List<SSTableWriter> newTableWriter, final List<SSTableFacade> newFacades) throws StorageManagerException {
    for (final SSTableWriter writer : newTableWriter) {
        final TupleStoreManagerRegistry tupleStoreManagerRegistry = storage.getTupleStoreManagerRegistry();
        final BBoxDBConfiguration configuration = tupleStoreManagerRegistry.getConfiguration();
        final int sstableKeyCacheEntries = configuration.getSstableKeyCacheEntries();
        final SSTableFacade newFacade = new SSTableFacade(writer.getDirectory(), writer.getName(), writer.getTablenumber(), sstableKeyCacheEntries);
        newFacades.add(newFacade);
    }
}
Also used : TupleStoreManagerRegistry(org.bboxdb.storage.tuplestore.manager.TupleStoreManagerRegistry) BBoxDBConfiguration(org.bboxdb.misc.BBoxDBConfiguration) SSTableWriter(org.bboxdb.storage.sstable.SSTableWriter) SSTableFacade(org.bboxdb.storage.sstable.reader.SSTableFacade)

Example 4 with BBoxDBConfiguration

use of org.bboxdb.misc.BBoxDBConfiguration in project bboxdb by jnidzwetzki.

the class DiskStorage method startCheckpointThread.

/**
 * Start the checkpoint thread for the storage
 */
private void startCheckpointThread() {
    final BBoxDBConfiguration configuration = tupleStoreManagerRegistry.getConfiguration();
    if (configuration.getStorageCheckpointInterval() > 0) {
        final int maxUncheckpointedSeconds = configuration.getStorageCheckpointInterval();
        final SSTableCheckpointRunnable ssTableCheckpointThread = new SSTableCheckpointRunnable(this, maxUncheckpointedSeconds);
        final Thread checkpointThread = new Thread(ssTableCheckpointThread);
        checkpointThread.setName("Checkpoint thread for: " + basedir);
        checkpointThread.start();
        runningThreads.add(checkpointThread);
    }
}
Also used : BBoxDBConfiguration(org.bboxdb.misc.BBoxDBConfiguration) SSTableCheckpointRunnable(org.bboxdb.storage.sstable.SSTableCheckpointRunnable)

Example 5 with BBoxDBConfiguration

use of org.bboxdb.misc.BBoxDBConfiguration in project bboxdb by jnidzwetzki.

the class PerformanceCounterService method init.

@Override
public void init() throws InterruptedException, BBoxDBException {
    final BBoxDBConfiguration bboxDBConfiguration = BBoxDBConfigurationManager.getConfiguration();
    final int port = bboxDBConfiguration.getPerformanceCounterPort();
    // Service is disabled
    if (port == -1) {
        logger.info("Performance counter service is disabled");
        return;
    }
    logger.info("Starting performance counter service on port: {}", port);
    // Expose JVM stats
    DefaultExports.initialize();
    try {
        server = new HTTPServer(port);
    } catch (IOException e) {
        logger.error("Got an exception during starting up performance counter HTTP sever", e);
    }
}
Also used : HTTPServer(io.prometheus.client.exporter.HTTPServer) BBoxDBConfiguration(org.bboxdb.misc.BBoxDBConfiguration) IOException(java.io.IOException)

Aggregations

BBoxDBConfiguration (org.bboxdb.misc.BBoxDBConfiguration)11 File (java.io.File)3 BBoxDBInstance (org.bboxdb.distribution.membership.BBoxDBInstance)2 ZookeeperClient (org.bboxdb.distribution.zookeeper.ZookeeperClient)2 Test (org.junit.Test)2 HTTPServer (io.prometheus.client.exporter.HTTPServer)1 IOException (java.io.IOException)1 ZookeeperInstanceRegisterer (org.bboxdb.distribution.zookeeper.ZookeeperInstanceRegisterer)1 Tuple (org.bboxdb.storage.entity.Tuple)1 TupleStoreConfiguration (org.bboxdb.storage.entity.TupleStoreConfiguration)1 SSTableCheckpointRunnable (org.bboxdb.storage.sstable.SSTableCheckpointRunnable)1 SSTableWriter (org.bboxdb.storage.sstable.SSTableWriter)1 SSTableFacade (org.bboxdb.storage.sstable.reader.SSTableFacade)1 TupleStoreManager (org.bboxdb.storage.tuplestore.manager.TupleStoreManager)1 TupleStoreManagerRegistry (org.bboxdb.storage.tuplestore.manager.TupleStoreManagerRegistry)1