use of voldemort.server.rebalance.Rebalancer in project voldemort by voldemort.
the class RebalanceMetadataConsistencyTest method setUp.
@Before
public void setUp() {
currentCluster = ServerTestUtils.getLocalCluster(3, new int[][] { { 0 }, { 1, 3 }, { 2 } });
finalCluster = ServerTestUtils.getLocalCluster(3, new int[][] { { 0 }, { 1 }, { 2 }, { 3 } });
rwStoreDefWithReplication = new StoreDefinitionBuilder().setName(testStoreNameRW).setType(BdbStorageConfiguration.TYPE_NAME).setKeySerializer(new SerializerDefinition("string")).setValueSerializer(new SerializerDefinition("string")).setRoutingPolicy(RoutingTier.CLIENT).setRoutingStrategyType(RoutingStrategyType.CONSISTENT_STRATEGY).setReplicationFactor(2).setPreferredReads(1).setRequiredReads(1).setPreferredWrites(1).setRequiredWrites(1).build();
Store<String, String, String> innerStore = new InMemoryStorageEngine<String, String, String>("inner-store");
innerStore.put(MetadataStore.CLUSTER_KEY, new Versioned<String>(new ClusterMapper().writeCluster(currentCluster)), null);
innerStore.put(MetadataStore.STORES_KEY, new Versioned<String>(new StoreDefinitionsMapper().writeStoreList(Lists.newArrayList(rwStoreDefWithReplication))), null);
rwStoreDefWithReplication2 = new StoreDefinitionBuilder().setName(testStoreNameRW2).setType(BdbStorageConfiguration.TYPE_NAME).setKeySerializer(new SerializerDefinition("string")).setValueSerializer(new SerializerDefinition("string")).setRoutingPolicy(RoutingTier.CLIENT).setRoutingStrategyType(RoutingStrategyType.CONSISTENT_STRATEGY).setReplicationFactor(2).setPreferredReads(1).setRequiredReads(1).setPreferredWrites(1).setRequiredWrites(1).build();
metadataStore = MetadataStore.createInMemoryMetadataStore(innerStore, 0);
rebalancer = new Rebalancer(null, metadataStore, null, null);
}
use of voldemort.server.rebalance.Rebalancer in project voldemort by voldemort.
the class VoldemortServer method createBasicServices.
private List<VoldemortService> createBasicServices() {
/* Services are given in the order they must be started */
List<VoldemortService> services = new ArrayList<VoldemortService>();
SchedulerService scheduler = new SchedulerService(voldemortConfig.getSchedulerThreads(), SystemTime.INSTANCE, voldemortConfig.canInterruptService());
storageService = new StorageService(storeRepository, metadata, scheduler, voldemortConfig);
asyncService = new AsyncOperationService(scheduler, ASYNC_REQUEST_CACHE_SIZE);
jmxService = null;
services.add(storageService);
services.add(scheduler);
services.add(asyncService);
if (voldemortConfig.isAdminServerEnabled()) {
Rebalancer rebalancer = null;
if (voldemortConfig.isEnableRebalanceService()) {
RebalancerService rebalancerService = new RebalancerService(storeRepository, metadata, voldemortConfig, asyncService, scheduler);
services.add(rebalancerService);
rebalancer = rebalancerService.getRebalancer();
}
SocketRequestHandlerFactory adminRequestHandlerFactory = new SocketRequestHandlerFactory(storageService, this.storeRepository, this.metadata, this.voldemortConfig, this.asyncService, scheduler, rebalancer, this);
if (voldemortConfig.getUseNioConnector()) {
logger.info("Using NIO Connector for Admin Service.");
services.add(new NioSocketService(adminRequestHandlerFactory, identityNode.getAdminPort(), voldemortConfig.getAdminSocketBufferSize(), voldemortConfig.isNioAdminConnectorKeepAlive(), voldemortConfig.getNioAdminConnectorSelectors(), "admin-server", voldemortConfig.isJmxEnabled(), voldemortConfig.getNioAcceptorBacklog(), voldemortConfig.getNioSelectorMaxHeartBeatTimeMs()));
} else {
logger.info("Using BIO Connector for Admin Service.");
services.add(new SocketService(adminRequestHandlerFactory, identityNode.getAdminPort(), voldemortConfig.getAdminCoreThreads(), voldemortConfig.getAdminMaxThreads(), voldemortConfig.getAdminSocketBufferSize(), "admin-server", voldemortConfig.isJmxEnabled()));
}
}
if (voldemortConfig.isGossipEnabled()) {
services.add(new GossipService(this.metadata, scheduler, voldemortConfig));
}
if (voldemortConfig.isJmxEnabled()) {
jmxService = new JmxService(this, this.metadata.getCluster(), storeRepository, services);
services.add(jmxService);
}
return ImmutableList.copyOf(services);
}
Aggregations