Search in sources :

Example 6 with ZKClientConfig

use of io.pravega.controller.store.client.ZKClientConfig in project pravega by pravega.

the class ZKBackedControllerServiceStarterTest method setup.

@Override
public void setup() throws Exception {
    zkServer = new TestingServerStarter().start();
    ZKClientConfig zkClientConfig = ZKClientConfigImpl.builder().connectionString(zkServer.getConnectString()).initialSleepInterval(500).maxRetries(10).namespace("pravega/" + UUID.randomUUID()).sessionTimeoutMs(10 * 1000).build();
    storeClientConfig = getStoreConfig(zkClientConfig);
    storeClient = StoreClientFactory.createStoreClient(storeClientConfig);
    executor = ExecutorServiceHelpers.newScheduledThreadPool(5, "test");
    segments = new ConcurrentHashMap<>();
    segmentEvent = new ConcurrentHashMap<>();
    writers = new ConcurrentHashMap<>();
    writerEventNumber = new ConcurrentHashMap<>();
}
Also used : ZKClientConfig(io.pravega.controller.store.client.ZKClientConfig) TestingServerStarter(io.pravega.test.common.TestingServerStarter)

Example 7 with ZKClientConfig

use of io.pravega.controller.store.client.ZKClientConfig in project pravega by pravega.

the class ZKClientConfigImplTests method testToStringIsSuccessfulWithAllConfigSpecified.

// region Tests that verify the toString() method.
// Note: It might seem odd that we are unit testing the toString() method of the code under test. The reason we are
// doing that is that the method is hand-rolled and there is a bit of logic there that isn't entirely unlikely to fail.
@Test
public void testToStringIsSuccessfulWithAllConfigSpecified() {
    ZKClientConfig config = new ZKClientConfigImpl("connectString", "namespace", 5, 2, 60000, true, "/zk.truststore.jks", "zk.truststore.password");
    assertNotNull(config.toString());
}
Also used : ZKClientConfig(io.pravega.controller.store.client.ZKClientConfig) Test(org.junit.Test)

Example 8 with ZKClientConfig

use of io.pravega.controller.store.client.ZKClientConfig in project pravega by pravega.

the class ZKClientConfigImplTests method testToStringIsSuccessfulWithTlsDisabled.

@Test
public void testToStringIsSuccessfulWithTlsDisabled() {
    ZKClientConfig config = new ZKClientConfigImpl("connectString", "namespace", 5, 2, 60000, false, null, null);
    assertNotNull(config.toString());
}
Also used : ZKClientConfig(io.pravega.controller.store.client.ZKClientConfig) Test(org.junit.Test)

Example 9 with ZKClientConfig

use of io.pravega.controller.store.client.ZKClientConfig 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).secureConnectionToZooKeeper(this.secureZK).trustStorePath(jksTrustFile).trustStorePasswordPath(keyPasswordFile).build();
    StoreClientConfig storeClientConfig = StoreClientConfigImpl.withPravegaTablesClient(zkClientConfig);
    HostMonitorConfig hostMonitorConfig = HostMonitorConfigImpl.builder().hostMonitorEnabled(true).containerCount(containerCount).hostMonitorMinRebalanceInterval(1).build();
    TimeoutServiceConfig timeoutServiceConfig = TimeoutServiceConfig.builder().maxLeaseValue(Config.MAX_LEASE_VALUE).build();
    ControllerEventProcessorConfig eventProcessorConfig = ControllerEventProcessorConfigImpl.withDefaultBuilder().shutdownTimeout(Duration.ofMillis(100)).build();
    GRPCServerConfig grpcServerConfig = GRPCServerConfigImpl.builder().port(this.controllerPorts[controllerId]).publishedRPCHost("localhost").publishedRPCPort(this.controllerPorts[controllerId]).authorizationEnabled(this.enableAuth).tlsEnabled(this.enableTls).tlsProtocolVersion(this.tlsProtocolVersion).tlsTrustStore(this.certFile).tlsCertFile(this.certFile).tlsKeyFile(this.keyFile).userPasswordFile(this.passwdFile).tokenSigningKey("secret").accessTokenTTLInSeconds(600).replyWithStackTraceOnError(false).requestTracingEnabled(true).build();
    RESTServerConfig restServerConfig = null;
    if (this.enableRestServer) {
        restServerConfig = RESTServerConfigImpl.builder().host("0.0.0.0").port(this.restServerPort).tlsEnabled(this.enableTls).tlsProtocolVersion(this.tlsProtocolVersion).keyFilePath(this.jksKeyFile).keyFilePasswordPath(this.keyPasswordFile).build();
    }
    ControllerServiceConfig serviceConfig = ControllerServiceConfigImpl.builder().threadPoolSize(Runtime.getRuntime().availableProcessors()).storeClientConfig(storeClientConfig).hostMonitorConfig(hostMonitorConfig).controllerClusterListenerEnabled(false).timeoutServiceConfig(timeoutServiceConfig).eventProcessorConfig(Optional.of(eventProcessorConfig)).grpcServerConfig(Optional.of(grpcServerConfig)).restServerConfig(Optional.ofNullable(restServerConfig)).shutdownTimeout(Duration.ofMillis(100)).build();
    ControllerServiceMain controllerService = new ControllerServiceMain(serviceConfig);
    try {
        controllerService.startAsync().awaitRunning();
        return controllerService;
    } catch (Throwable ex) {
        Callbacks.invokeSafely(controllerService::close, ex2 -> log.error("Unable to clean up controller startup.", ex2));
        throw ex;
    }
}
Also used : ControllerEventProcessorConfig(io.pravega.controller.server.eventProcessor.ControllerEventProcessorConfig) Arrays(java.util.Arrays) ZooKeeperServiceRunner(io.pravega.segmentstore.storage.impl.bookkeeper.ZooKeeperServiceRunner) ZKClientConfigImpl(io.pravega.controller.store.client.impl.ZKClientConfigImpl) Cleanup(lombok.Cleanup) ServiceBuilderConfig(io.pravega.segmentstore.server.store.ServiceBuilderConfig) RESTServerConfigImpl(io.pravega.shared.rest.impl.RESTServerConfigImpl) ControllerServiceConfigImpl(io.pravega.controller.server.impl.ControllerServiceConfigImpl) StoreClientConfigImpl(io.pravega.controller.store.client.impl.StoreClientConfigImpl) HostMonitorConfig(io.pravega.controller.store.host.HostMonitorConfig) Duration(java.time.Duration) ToString(lombok.ToString) URI(java.net.URI) ServiceStarter(io.pravega.segmentstore.server.host.ServiceStarter) AutoScalerConfig(io.pravega.segmentstore.server.host.stat.AutoScalerConfig) Synchronized(lombok.Synchronized) DurableLogConfig(io.pravega.segmentstore.server.logs.DurableLogConfig) UUID(java.util.UUID) GuardedBy(javax.annotation.concurrent.GuardedBy) Collectors(java.util.stream.Collectors) Slf4j(lombok.extern.slf4j.Slf4j) CuratorFramework(org.apache.curator.framework.CuratorFramework) Builder(lombok.Builder) Config(io.pravega.controller.util.Config) RetryPolicy(org.apache.curator.RetryPolicy) StorageLayoutType(io.pravega.segmentstore.storage.StorageLayoutType) Optional(java.util.Optional) ZKClientConfig(io.pravega.controller.store.client.ZKClientConfig) GRPCServerConfig(io.pravega.controller.server.rpc.grpc.GRPCServerConfig) StoreClientConfig(io.pravega.controller.store.client.StoreClientConfig) CuratorFrameworkFactory(org.apache.curator.framework.CuratorFrameworkFactory) ControllerServiceConfig(io.pravega.controller.server.ControllerServiceConfig) ZKTLSUtils(io.pravega.common.security.ZKTLSUtils) ServiceConfig(io.pravega.segmentstore.server.store.ServiceConfig) GRPCServerConfigImpl(io.pravega.controller.server.rpc.grpc.impl.GRPCServerConfigImpl) TimeoutServiceConfig(io.pravega.controller.timeout.TimeoutServiceConfig) Strings(com.google.common.base.Strings) ControllerEventProcessorConfigImpl(io.pravega.controller.server.eventProcessor.impl.ControllerEventProcessorConfigImpl) ExponentialBackoffRetry(org.apache.curator.retry.ExponentialBackoffRetry) RESTServerConfig(io.pravega.shared.rest.RESTServerConfig) DefaultCredentials(io.pravega.shared.security.auth.DefaultCredentials) TLSProtocolVersion(io.pravega.common.security.TLSProtocolVersion) HostMonitorConfigImpl(io.pravega.controller.store.host.impl.HostMonitorConfigImpl) Callbacks(io.pravega.common.function.Callbacks) ControllerEventProcessorConfig(io.pravega.controller.server.eventProcessor.ControllerEventProcessorConfig) IOException(java.io.IOException) ControllerServiceMain(io.pravega.controller.server.ControllerServiceMain) MetricsConfig(io.pravega.shared.metrics.MetricsConfig) Credentials(io.pravega.shared.security.auth.Credentials) Preconditions(com.google.common.base.Preconditions) 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.shared.rest.RESTServerConfig) ControllerServiceMain(io.pravega.controller.server.ControllerServiceMain)

Aggregations

ZKClientConfig (io.pravega.controller.store.client.ZKClientConfig)9 TestingServerStarter (io.pravega.test.common.TestingServerStarter)5 StoreClientConfig (io.pravega.controller.store.client.StoreClientConfig)3 HostMonitorConfig (io.pravega.controller.store.host.HostMonitorConfig)3 IOException (java.io.IOException)3 Test (org.junit.Test)3 ControllerEventProcessorConfig (io.pravega.controller.server.eventProcessor.ControllerEventProcessorConfig)2 GRPCServerConfig (io.pravega.controller.server.rpc.grpc.GRPCServerConfig)2 TimeoutServiceConfig (io.pravega.controller.timeout.TimeoutServiceConfig)2 RESTServerConfig (io.pravega.shared.rest.RESTServerConfig)2 Preconditions (com.google.common.base.Preconditions)1 Strings (com.google.common.base.Strings)1 Host (io.pravega.common.cluster.Host)1 Callbacks (io.pravega.common.function.Callbacks)1 TLSProtocolVersion (io.pravega.common.security.TLSProtocolVersion)1 ZKTLSUtils (io.pravega.common.security.ZKTLSUtils)1 ControllerServiceConfig (io.pravega.controller.server.ControllerServiceConfig)1 ControllerServiceMain (io.pravega.controller.server.ControllerServiceMain)1 ControllerEventProcessorConfigImpl (io.pravega.controller.server.eventProcessor.impl.ControllerEventProcessorConfigImpl)1 ControllerServiceConfigImpl (io.pravega.controller.server.impl.ControllerServiceConfigImpl)1