Search in sources :

Example 6 with HostMonitorConfig

use of io.pravega.controller.store.host.HostMonitorConfig in project pravega by pravega.

the class HostStoreTest method zkHostStoreTests.

@Test
public void zkHostStoreTests() {
    try {
        @Cleanup TestingServer zkTestServer = new TestingServerStarter().start();
        ZKClientConfig zkClientConfig = ZKClientConfigImpl.builder().connectionString(zkTestServer.getConnectString()).initialSleepInterval(2000).maxRetries(1).sessionTimeoutMs(10 * 1000).namespace("hostStoreTest/" + UUID.randomUUID()).build();
        StoreClientConfig storeClientConfig = StoreClientConfigImpl.withZKClient(zkClientConfig);
        @Cleanup StoreClient storeClient = StoreClientFactory.createStoreClient(storeClientConfig);
        HostMonitorConfig hostMonitorConfig = HostMonitorConfigImpl.builder().hostMonitorEnabled(true).hostMonitorMinRebalanceInterval(10).containerCount(containerCount).build();
        // Create ZK based host store.
        HostControllerStore hostStore = HostStoreFactory.createStore(hostMonitorConfig, storeClient);
        // Update host store map.
        hostStore.updateHostContainersMap(HostMonitorConfigImpl.getHostContainerMap(host, controllerPort, containerCount));
        validateStore(hostStore);
    } catch (Exception e) {
        log.error("Unexpected error", e);
        Assert.fail();
    }
}
Also used : TestingServer(org.apache.curator.test.TestingServer) StoreClient(io.pravega.controller.store.client.StoreClient) ZKClientConfig(io.pravega.controller.store.client.ZKClientConfig) TestingServerStarter(io.pravega.test.common.TestingServerStarter) HostControllerStore(io.pravega.controller.store.host.HostControllerStore) StoreClientConfig(io.pravega.controller.store.client.StoreClientConfig) Cleanup(lombok.Cleanup) HostMonitorConfig(io.pravega.controller.store.host.HostMonitorConfig) Test(org.junit.Test)

Example 7 with HostMonitorConfig

use of io.pravega.controller.store.host.HostMonitorConfig 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)

Example 8 with HostMonitorConfig

use of io.pravega.controller.store.host.HostMonitorConfig in project pravega by pravega.

the class ControllerServiceStarterTest method createControllerServiceConfig.

protected ControllerServiceConfig createControllerServiceConfig() {
    HostMonitorConfig hostMonitorConfig = HostMonitorConfigImpl.builder().hostMonitorEnabled(false).hostMonitorMinRebalanceInterval(Config.CLUSTER_MIN_REBALANCE_INTERVAL).containerCount(Config.HOST_STORE_CONTAINER_COUNT).hostContainerMap(HostMonitorConfigImpl.getHostContainerMap(Config.SERVICE_HOST, Config.SERVICE_PORT, Config.HOST_STORE_CONTAINER_COUNT)).build();
    TimeoutServiceConfig timeoutServiceConfig = TimeoutServiceConfig.builder().maxLeaseValue(Config.MAX_LEASE_VALUE).maxScaleGracePeriod(Config.MAX_SCALE_GRACE_PERIOD).build();
    return ControllerServiceConfigImpl.builder().threadPoolSize(15).storeClientConfig(storeClientConfig).controllerClusterListenerEnabled(!disableControllerCluster).hostMonitorConfig(hostMonitorConfig).timeoutServiceConfig(timeoutServiceConfig).eventProcessorConfig(Optional.empty()).grpcServerConfig(Optional.of(GRPCServerConfigImpl.builder().port(grpcPort).authorizationEnabled(enableAuth).tlsEnabled(enableAuth).tlsCertFile("../config/cert.pem").tlsKeyFile("../config/key.pem").build())).restServerConfig(Optional.empty()).build();
}
Also used : TimeoutServiceConfig(io.pravega.controller.timeout.TimeoutServiceConfig) HostMonitorConfig(io.pravega.controller.store.host.HostMonitorConfig)

Example 9 with HostMonitorConfig

use of io.pravega.controller.store.host.HostMonitorConfig in project pravega by pravega.

the class HostStoreTest method inMemoryStoreTests.

@Test
public void inMemoryStoreTests() {
    HostMonitorConfig hostMonitorConfig = HostMonitorConfigImpl.builder().hostMonitorEnabled(false).hostContainerMap(HostMonitorConfigImpl.getHostContainerMap(host, controllerPort, containerCount)).hostMonitorMinRebalanceInterval(10).containerCount(containerCount).build();
    // Create a host store
    HostControllerStore hostStore = HostStoreFactory.createInMemoryStore(hostMonitorConfig);
    validateStore(hostStore);
    // Create a host store via other factory method
    hostStore = HostStoreFactory.createStore(hostMonitorConfig, StoreClientFactory.createInMemoryStoreClient());
    validateStore(hostStore);
}
Also used : HostControllerStore(io.pravega.controller.store.host.HostControllerStore) HostMonitorConfig(io.pravega.controller.store.host.HostMonitorConfig) Test(org.junit.Test)

Aggregations

HostMonitorConfig (io.pravega.controller.store.host.HostMonitorConfig)9 TimeoutServiceConfig (io.pravega.controller.timeout.TimeoutServiceConfig)5 Test (org.junit.Test)5 StoreClientConfig (io.pravega.controller.store.client.StoreClientConfig)4 HostControllerStore (io.pravega.controller.store.host.HostControllerStore)4 ZKClientConfig (io.pravega.controller.store.client.ZKClientConfig)3 ControllerEventProcessorConfig (io.pravega.controller.server.eventProcessor.ControllerEventProcessorConfig)2 RESTServerConfig (io.pravega.controller.server.rest.RESTServerConfig)2 GRPCServerConfig (io.pravega.controller.server.rpc.grpc.GRPCServerConfig)2 ControllerServiceConfig (io.pravega.controller.server.ControllerServiceConfig)1 ControllerServiceMain (io.pravega.controller.server.ControllerServiceMain)1 StoreClient (io.pravega.controller.store.client.StoreClient)1 TestingServerStarter (io.pravega.test.common.TestingServerStarter)1 Cleanup (lombok.Cleanup)1 TestingServer (org.apache.curator.test.TestingServer)1