Search in sources :

Example 6 with ConnectorConfig

use of com.couchbase.connector.config.es.ConnectorConfig in project couchbase-elasticsearch-connector by couchbase.

the class PauseCommand method run.

@Override
public void run() {
    final ConsulContext ctx = new ConsulContext(consulBuilder(), group, null);
    validateGroup(ctx);
    final Consul consul = ctx.consul();
    final String configKey = ctx.keys().config();
    final String configString = consul.keyValueClient().getValueAsString(configKey, UTF_8).orElse(null);
    if (Strings.isNullOrEmpty(configString)) {
        System.err.println("ERROR: Connector configuration document does not exist, or is empty.");
        System.exit(1);
    }
    final ConnectorConfig config = ConnectorConfig.from(configString);
    try {
        CheckpointBackup.backup(config, output);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
Also used : ConnectorConfig(com.couchbase.connector.config.es.ConnectorConfig) IOException(java.io.IOException) Consul(com.orbitz.consul.Consul) ConsulContext(com.couchbase.connector.cluster.consul.ConsulContext)

Aggregations

ConnectorConfig (com.couchbase.connector.config.es.ConnectorConfig)6 File (java.io.File)4 OptionSet (joptsimple.OptionSet)4 ImmutableConnectorConfig (com.couchbase.connector.config.es.ImmutableConnectorConfig)2 Slf4jReporter (com.codahale.metrics.Slf4jReporter)1 SeedNode (com.couchbase.client.core.env.SeedNode)1 LogRedaction (com.couchbase.client.core.logging.LogRedaction)1 RedactableArgument.redactSystem (com.couchbase.client.core.logging.RedactableArgument.redactSystem)1 Client (com.couchbase.client.dcp.Client)1 StreamFrom (com.couchbase.client.dcp.StreamFrom)1 StreamTo (com.couchbase.client.dcp.StreamTo)1 LogLevel (com.couchbase.client.dcp.metrics.LogLevel)1 Version (com.couchbase.client.dcp.util.Version)1 Bucket (com.couchbase.client.java.Bucket)1 Cluster (com.couchbase.client.java.Cluster)1 Collection (com.couchbase.client.java.Collection)1 ClusterEnvironment (com.couchbase.client.java.env.ClusterEnvironment)1 VersionHelper.getVersionString (com.couchbase.connector.VersionHelper.getVersionString)1 DefaultPanicButton (com.couchbase.connector.cluster.DefaultPanicButton)1 Membership (com.couchbase.connector.cluster.Membership)1