Search in sources :

Example 6 with CassandraSchemaVersion

use of com.instaclustr.esop.impl.interaction.CassandraSchemaVersion in project esop by instaclustr.

the class ManifestTest method createTable.

private void createTable(String keyspace, String table) throws Exception {
    String currentVersion = new CassandraSchemaVersion(jmx).act();
    Thread.sleep(3000);
    session.execute(createKeyspace(keyspace).ifNotExists().withNetworkTopologyStrategy(of("datacenter1", 1)).build());
    Thread.sleep(5000);
    session.execute(SchemaBuilder.createTable(keyspace, table).ifNotExists().withPartitionKey(ID, TEXT).withClusteringColumn(DATE, TIMEUUID).withColumn(NAME, TEXT).build());
    waitUntilSchemaChange(currentVersion);
}
Also used : CassandraSchemaVersion(com.instaclustr.esop.impl.interaction.CassandraSchemaVersion)

Example 7 with CassandraSchemaVersion

use of com.instaclustr.esop.impl.interaction.CassandraSchemaVersion in project esop by instaclustr.

the class CassandraClusterTopology method act.

@Override
public ClusterTopology act() throws Exception {
    final String clusterName = new CassandraClusterName(cassandraJMXService).act();
    // map of endpoints and host ids
    final Map<InetAddress, UUID> endpoints = new CassandraEndpoints(cassandraJMXService).act();
    // map of endpoints and dc they belong to
    final Map<InetAddress, String> endpointDcs = new CassandraEndpointDC(cassandraJMXService, endpoints.keySet()).act();
    // map of endpoints and hostnames
    final Map<InetAddress, String> hostnames = new CassandraHostname(endpoints.keySet()).act();
    // map of endpoints and rack they belong to
    final Map<InetAddress, String> endpointRacks = new CassandraEndpointRack(cassandraJMXService, endpoints.keySet()).act();
    final String schemaVersion = new CassandraSchemaVersion(cassandraJMXService).act();
    final ClusterTopology resolvedTopology = constructTopology(clusterName, endpoints, endpointDcs, hostnames, endpointRacks, schemaVersion);
    final Set<String> invalidDcs = ClusterTopology.sanitizeDcs(dcs).stream().filter(dc -> !resolvedTopology.getDcs().contains(dc)).collect(toSet());
    if (!invalidDcs.isEmpty()) {
        throw new IllegalStateException(format("Some DCs to filter on do not exist: %s, existing: %s", invalidDcs, String.join(",", resolvedTopology.getDcs())));
    }
    logger.info(resolvedTopology.toString());
    return resolvedTopology;
}
Also used : Arrays(java.util.Arrays) LoggerFactory(org.slf4j.LoggerFactory) Collections.singletonList(java.util.Collections.singletonList) ArrayList(java.util.ArrayList) InetAddress(java.net.InetAddress) Map(java.util.Map) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore) CassandraInteraction(com.instaclustr.cassandra.CassandraInteraction) Path(java.nio.file.Path) Collectors.toSet(java.util.stream.Collectors.toSet) Backuper(com.instaclustr.esop.impl.backup.Backuper) CassandraSchemaVersion(com.instaclustr.esop.impl.interaction.CassandraSchemaVersion) Logger(org.slf4j.Logger) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Set(java.util.Set) MoreObjects(com.google.common.base.MoreObjects) IOException(java.io.IOException) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) String.format(java.lang.String.format) File(java.io.File) Objects(java.util.Objects) Collectors.toList(java.util.stream.Collectors.toList) List(java.util.List) Paths(java.nio.file.Paths) Entry(java.util.Map.Entry) Optional(java.util.Optional) Collections(java.util.Collections) ClusterTopology(com.instaclustr.esop.topology.CassandraClusterTopology.ClusterTopology) CassandraJMXService(jmx.org.apache.cassandra.service.CassandraJMXService) ClusterTopology(com.instaclustr.esop.topology.CassandraClusterTopology.ClusterTopology) CassandraSchemaVersion(com.instaclustr.esop.impl.interaction.CassandraSchemaVersion) UUID(java.util.UUID) InetAddress(java.net.InetAddress)

Aggregations

CassandraSchemaVersion (com.instaclustr.esop.impl.interaction.CassandraSchemaVersion)7 Manifest (com.instaclustr.esop.impl.Manifest)3 Snapshots (com.instaclustr.esop.impl.Snapshots)3 TakeSnapshotOperationRequest (com.instaclustr.esop.impl.backup.coordination.TakeSnapshotOperation.TakeSnapshotOperationRequest)3 CassandraTokens (com.instaclustr.esop.impl.interaction.CassandraTokens)3 Path (java.nio.file.Path)3 CqlSession (com.datastax.oss.driver.api.core.CqlSession)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 Cassandra (com.github.nosan.embedded.cassandra.Cassandra)2 Manifest.getLocalManifestPath (com.instaclustr.esop.impl.Manifest.getLocalManifestPath)2 Manifest.getManifestAsManifestEntry (com.instaclustr.esop.impl.Manifest.getManifestAsManifestEntry)2 ManifestEntry (com.instaclustr.esop.impl.ManifestEntry)2 Snapshot (com.instaclustr.esop.impl.Snapshots.Snapshot)2 Backuper (com.instaclustr.esop.impl.backup.Backuper)2 ClearSnapshotOperationRequest (com.instaclustr.esop.impl.backup.coordination.ClearSnapshotOperation.ClearSnapshotOperationRequest)2 TakeSnapshotOperation (com.instaclustr.esop.impl.backup.coordination.TakeSnapshotOperation)2 ClusterTopology (com.instaclustr.esop.topology.CassandraClusterTopology.ClusterTopology)2 IOException (java.io.IOException)2 String.format (java.lang.String.format)2 List (java.util.List)2