Search in sources :

Example 1 with ControllerServiceMain

use of io.pravega.controller.server.ControllerServiceMain 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;
    }
}
Also used : ServiceStarter(io.pravega.segmentstore.server.host.ServiceStarter) ControllerServiceMain(io.pravega.controller.server.ControllerServiceMain) Synchronized(lombok.Synchronized)

Example 2 with ControllerServiceMain

use of io.pravega.controller.server.ControllerServiceMain in project pravega by pravega.

the class InProcPravegaCluster method startLocalController.

private ControllerServiceMain startLocalController(int controllerId) {
    ZKClientConfig zkClientConfig = ZKClientConfigImpl.builder().connectionString(zkUrl).namespace("pravega/" + clusterName).initialSleepInterval(2000).maxRetries(1).sessionTimeoutMs(10 * 1000).build();
    StoreClientConfig storeClientConfig = StoreClientConfigImpl.withZKClient(zkClientConfig);
    HostMonitorConfig hostMonitorConfig = HostMonitorConfigImpl.builder().hostMonitorEnabled(true).hostMonitorMinRebalanceInterval(Config.CLUSTER_MIN_REBALANCE_INTERVAL).containerCount(Config.HOST_STORE_CONTAINER_COUNT).build();
    TimeoutServiceConfig timeoutServiceConfig = TimeoutServiceConfig.builder().maxLeaseValue(Config.MAX_LEASE_VALUE).maxScaleGracePeriod(Config.MAX_SCALE_GRACE_PERIOD).build();
    ControllerEventProcessorConfig eventProcessorConfig = ControllerEventProcessorConfigImpl.withDefault();
    GRPCServerConfig grpcServerConfig = GRPCServerConfigImpl.builder().port(this.controllerPorts[controllerId]).publishedRPCHost("localhost").publishedRPCPort(this.controllerPorts[controllerId]).authorizationEnabled(this.enableAuth).tlsEnabled(this.enableTls).tlsTrustStore("../config/cert.pem").tlsCertFile("../config/cert.pem").tlsKeyFile("../config/key.pem").userPasswordFile("../config/passwd").tokenSigningKey("secret").build();
    RESTServerConfig restServerConfig = RESTServerConfigImpl.builder().host("0.0.0.0").port(this.restServerPort).build();
    ControllerServiceConfig serviceConfig = ControllerServiceConfigImpl.builder().threadPoolSize(Config.ASYNC_TASK_POOL_SIZE).storeClientConfig(storeClientConfig).hostMonitorConfig(hostMonitorConfig).controllerClusterListenerEnabled(false).timeoutServiceConfig(timeoutServiceConfig).eventProcessorConfig(Optional.of(eventProcessorConfig)).grpcServerConfig(Optional.of(grpcServerConfig)).restServerConfig(Optional.of(restServerConfig)).build();
    ControllerServiceMain controllerService = new ControllerServiceMain(serviceConfig);
    controllerService.startAsync();
    return controllerService;
}
Also used : ControllerEventProcessorConfig(io.pravega.controller.server.eventProcessor.ControllerEventProcessorConfig) TimeoutServiceConfig(io.pravega.controller.timeout.TimeoutServiceConfig) ZKClientConfig(io.pravega.controller.store.client.ZKClientConfig) GRPCServerConfig(io.pravega.controller.server.rpc.grpc.GRPCServerConfig) StoreClientConfig(io.pravega.controller.store.client.StoreClientConfig) ControllerServiceConfig(io.pravega.controller.server.ControllerServiceConfig) HostMonitorConfig(io.pravega.controller.store.host.HostMonitorConfig) RESTServerConfig(io.pravega.controller.server.rest.RESTServerConfig) ControllerServiceMain(io.pravega.controller.server.ControllerServiceMain)

Aggregations

ControllerServiceMain (io.pravega.controller.server.ControllerServiceMain)2 ControllerServiceConfig (io.pravega.controller.server.ControllerServiceConfig)1 ControllerEventProcessorConfig (io.pravega.controller.server.eventProcessor.ControllerEventProcessorConfig)1 RESTServerConfig (io.pravega.controller.server.rest.RESTServerConfig)1 GRPCServerConfig (io.pravega.controller.server.rpc.grpc.GRPCServerConfig)1 StoreClientConfig (io.pravega.controller.store.client.StoreClientConfig)1 ZKClientConfig (io.pravega.controller.store.client.ZKClientConfig)1 HostMonitorConfig (io.pravega.controller.store.host.HostMonitorConfig)1 TimeoutServiceConfig (io.pravega.controller.timeout.TimeoutServiceConfig)1 ServiceStarter (io.pravega.segmentstore.server.host.ServiceStarter)1 Synchronized (lombok.Synchronized)1