use of io.pravega.segmentstore.server.host.ServiceStarter in project pravega by pravega.
the class InProcPravegaCluster method close.
@Override
@Synchronized
public void close() throws Exception {
if (isInProcSegmentStore) {
for (ServiceStarter starter : this.nodeServiceStarter) {
starter.shutdown();
}
}
if (isInProcController) {
for (ControllerServiceMain controller : this.controllerServers) {
controller.stopAsync();
}
}
if (this.zkService != null) {
this.zkService.close();
this.zkService = null;
}
}
use of io.pravega.segmentstore.server.host.ServiceStarter in project pravega by pravega.
the class InProcPravegaCluster method startLocalSegmentStore.
/**
* Starts a SegmentStore with the given id. This is re-entrant. Eventually this will allow starting and stopping of
* individual SegmentStore instances. This is not possible right now.
*
* @param segmentStoreId id of the SegmentStore.
*/
private void startLocalSegmentStore(int segmentStoreId) throws Exception {
ServiceBuilderConfig.Builder configBuilder = ServiceBuilderConfig.builder().include(System.getProperties()).include(ServiceConfig.builder().with(ServiceConfig.CONTAINER_COUNT, containerCount).with(ServiceConfig.THREAD_POOL_SIZE, THREADPOOL_SIZE).with(ServiceConfig.ZK_URL, "localhost:" + zkPort).with(ServiceConfig.LISTENING_PORT, this.segmentStorePorts[segmentStoreId]).with(ServiceConfig.CLUSTER_NAME, this.clusterName).with(ServiceConfig.ENABLE_TLS, this.enableTls).with(ServiceConfig.KEY_FILE, "../config/key.pem").with(ServiceConfig.CERT_FILE, "../config/cert.pem").with(ServiceConfig.DATALOG_IMPLEMENTATION, isInMemStorage ? ServiceConfig.DataLogType.INMEMORY : ServiceConfig.DataLogType.BOOKKEEPER).with(ServiceConfig.STORAGE_IMPLEMENTATION, isInMemStorage ? ServiceConfig.StorageType.INMEMORY : ServiceConfig.StorageType.FILESYSTEM)).include(DurableLogConfig.builder().with(DurableLogConfig.CHECKPOINT_COMMIT_COUNT, 100).with(DurableLogConfig.CHECKPOINT_MIN_COMMIT_COUNT, 100).with(DurableLogConfig.CHECKPOINT_TOTAL_COMMIT_LENGTH, 100 * 1024 * 1024L)).include(ReadIndexConfig.builder().with(ReadIndexConfig.CACHE_POLICY_MAX_TIME, 60 * 1000).with(ReadIndexConfig.CACHE_POLICY_MAX_SIZE, 128 * 1024 * 1024L)).include(AutoScalerConfig.builder().with(AutoScalerConfig.CONTROLLER_URI, "tcp://localhost:" + controllerPorts[0]).with(AutoScalerConfig.AUTH_USERNAME, "admin").with(AutoScalerConfig.AUTH_PASSWORD, "1111_aaaa").with(AutoScalerConfig.TOKEN_SIGNING_KEY, "secret").with(AutoScalerConfig.AUTH_ENABLED, this.enableAuth).with(AutoScalerConfig.TLS_ENABLED, this.enableTls).with(AutoScalerConfig.TLS_CERT_FILE, "../config/cert.pem")).include(MetricsConfig.builder().with(MetricsConfig.ENABLE_STATISTICS, enableMetrics));
nodeServiceStarter[segmentStoreId] = new ServiceStarter(configBuilder.build());
nodeServiceStarter[segmentStoreId].start();
}
Aggregations