Search in sources :

Example 1 with MembershipConnectionService

use of org.bboxdb.distribution.membership.MembershipConnectionService in project bboxdb by jnidzwetzki.

the class BBoxDBMain method init.

public void init() throws Exception {
    logger.info("Init the BBoxDB");
    services.clear();
    // The storage registry
    final TupleStoreManagerRegistry storageRegistry = new TupleStoreManagerRegistry();
    services.add(storageRegistry);
    // The zookeeper registerer
    final ZookeeperInstanceRegisterer zookeeperClient = new ZookeeperInstanceRegisterer();
    services.add(zookeeperClient);
    // The membership connection service
    final MembershipConnectionService membershipService = createMembershipService(storageRegistry);
    services.add(membershipService);
    // The network connection handler
    final NetworkConnectionService connectionHandler = createConnectionHandler(storageRegistry);
    services.add(connectionHandler);
    // The recovery service
    final DistributedRecoveryService recoveryService = new DistributedRecoveryService(storageRegistry);
    services.add(recoveryService);
    // The statistics update service
    final StatisticsUpdateService statisticsService = new StatisticsUpdateService(storageRegistry);
    services.add(statisticsService);
    // The JMX service
    final JMXService jmxService = new JMXService(this);
    services.add(jmxService);
    // The performance counter service
    final PerformanceCounterService performanceCounterService = new PerformanceCounterService();
    services.add(performanceCounterService);
    // Send flush events to zookeeper
    storageRegistry.registerSSTableFlushCallback(new TupleStoreFlushZookeeperAdapter());
}
Also used : NetworkConnectionService(org.bboxdb.network.server.NetworkConnectionService) DistributedRecoveryService(org.bboxdb.distribution.DistributedRecoveryService) PerformanceCounterService(org.bboxdb.performance.PerformanceCounterService) JMXService(org.bboxdb.jmx.JMXService) ZookeeperInstanceRegisterer(org.bboxdb.distribution.zookeeper.ZookeeperInstanceRegisterer) TupleStoreManagerRegistry(org.bboxdb.storage.tuplestore.manager.TupleStoreManagerRegistry) MembershipConnectionService(org.bboxdb.distribution.membership.MembershipConnectionService) StatisticsUpdateService(org.bboxdb.distribution.statistics.StatisticsUpdateService) TupleStoreFlushZookeeperAdapter(org.bboxdb.distribution.TupleStoreFlushZookeeperAdapter)

Example 2 with MembershipConnectionService

use of org.bboxdb.distribution.membership.MembershipConnectionService in project bboxdb by jnidzwetzki.

the class TupleRedistributor method registerRegion.

/**
 * Register a new region for distribution
 * @param distributionRegion
 * @throws StorageManagerException
 * @throws ZookeeperException
 */
public void registerRegion(final DistributionRegion distributionRegion) throws StorageManagerException {
    final ArrayList<AbstractTupleSink> sinks = new ArrayList<>();
    final Collection<BBoxDBInstance> instances = distributionRegion.getSystems();
    final MembershipConnectionService membershipConnectionService = MembershipConnectionService.getInstance();
    final BBoxDBInstance localInstance = ZookeeperClientFactory.getLocalInstanceName();
    for (final BBoxDBInstance instance : instances) {
        if (instance.socketAddressEquals(localInstance)) {
            final TupleStoreName localTableName = tupleStoreName.cloneWithDifferntRegionId(distributionRegion.getRegionId());
            final TupleStoreAdapter tupleStoreAdapter = ZookeeperClientFactory.getZookeeperClient().getTupleStoreAdapter();
            final TupleStoreConfiguration config = readTuplestoreConfig(localTableName, tupleStoreAdapter);
            final TupleStoreManager storageManager = tupleStoreManagerRegistry.createTableIfNotExist(localTableName, config);
            final LocalTupleSink tupleSink = new LocalTupleSink(tupleStoreName, storageManager);
            sinks.add(tupleSink);
            logger.info("Redistributing data to local table {}", localTableName.getFullname());
        } else {
            final BBoxDBConnection connection = membershipConnectionService.getConnectionForInstance(instance);
            final NetworkTupleSink tupleSink = new NetworkTupleSink(tupleStoreName, connection);
            sinks.add(tupleSink);
            logger.info("Redistributing data to remote system {}", instance.getInetSocketAddress());
        }
    }
    registerRegion(distributionRegion, sinks);
}
Also used : TupleStoreConfiguration(org.bboxdb.storage.entity.TupleStoreConfiguration) ArrayList(java.util.ArrayList) MembershipConnectionService(org.bboxdb.distribution.membership.MembershipConnectionService) TupleStoreAdapter(org.bboxdb.distribution.zookeeper.TupleStoreAdapter) TupleStoreName(org.bboxdb.storage.entity.TupleStoreName) BBoxDBInstance(org.bboxdb.distribution.membership.BBoxDBInstance) BBoxDBConnection(org.bboxdb.network.client.BBoxDBConnection) TupleStoreManager(org.bboxdb.storage.tuplestore.manager.TupleStoreManager)

Example 3 with MembershipConnectionService

use of org.bboxdb.distribution.membership.MembershipConnectionService in project bboxdb by jnidzwetzki.

the class BBoxDBMain method createMembershipService.

/**
 * Returns a new instance of the membership service
 * @param storageRegistry
 * @return
 */
public MembershipConnectionService createMembershipService(final TupleStoreManagerRegistry storageRegistry) {
    final MembershipConnectionService membershipService = MembershipConnectionService.getInstance();
    // Prevent network connections to ourself
    final BBoxDBInstance localhost = ZookeeperClientFactory.getLocalInstanceName();
    membershipService.addSystemToBlacklist(localhost);
    // The storage registry for gossip
    membershipService.setTupleStoreManagerRegistry(storageRegistry);
    return membershipService;
}
Also used : MembershipConnectionService(org.bboxdb.distribution.membership.MembershipConnectionService) BBoxDBInstance(org.bboxdb.distribution.membership.BBoxDBInstance)

Aggregations

MembershipConnectionService (org.bboxdb.distribution.membership.MembershipConnectionService)3 BBoxDBInstance (org.bboxdb.distribution.membership.BBoxDBInstance)2 ArrayList (java.util.ArrayList)1 DistributedRecoveryService (org.bboxdb.distribution.DistributedRecoveryService)1 TupleStoreFlushZookeeperAdapter (org.bboxdb.distribution.TupleStoreFlushZookeeperAdapter)1 StatisticsUpdateService (org.bboxdb.distribution.statistics.StatisticsUpdateService)1 TupleStoreAdapter (org.bboxdb.distribution.zookeeper.TupleStoreAdapter)1 ZookeeperInstanceRegisterer (org.bboxdb.distribution.zookeeper.ZookeeperInstanceRegisterer)1 JMXService (org.bboxdb.jmx.JMXService)1 BBoxDBConnection (org.bboxdb.network.client.BBoxDBConnection)1 NetworkConnectionService (org.bboxdb.network.server.NetworkConnectionService)1 PerformanceCounterService (org.bboxdb.performance.PerformanceCounterService)1 TupleStoreConfiguration (org.bboxdb.storage.entity.TupleStoreConfiguration)1 TupleStoreName (org.bboxdb.storage.entity.TupleStoreName)1 TupleStoreManager (org.bboxdb.storage.tuplestore.manager.TupleStoreManager)1 TupleStoreManagerRegistry (org.bboxdb.storage.tuplestore.manager.TupleStoreManagerRegistry)1