Test new datacenter name

This commit is contained in:
Ahmed Salah Tawfik Ibrahim 2023-12-07 14:14:23 +01:00
parent 02bc40b6e8
commit 70d7e31540
2 changed files with 8 additions and 6 deletions

View File

@ -145,7 +145,7 @@ public class CassandraClusterConnection {
CqlSession cqlSession = configBuilder(CqlSession.builder())
.addContactPoints(hosts)
.withKeyspace(KEYSPACE_NAME)
.withLocalDatacenter("1")
.withLocalDatacenter(datacenterName)
.build();
_log.info("[OK] Connected to Keyspace {} ", KEYSPACE_NAME);
return cqlSession;
@ -180,7 +180,7 @@ public class CassandraClusterConnection {
private static void createKeyspace(String keyspaceName, int replicationFactor) {
try (CqlSession cqlSession = configBuilder(CqlSession.builder())
.addContactPoints(hosts)
.withLocalDatacenter("1")
.withLocalDatacenter(datacenterName)
.build()) {
cqlSession.execute(SchemaBuilder.createKeyspace(keyspaceName)
.ifNotExists()
@ -196,7 +196,7 @@ public class CassandraClusterConnection {
ResultSet toreturn;
try (CqlSession cqlSession = configBuilder(CqlSession.builder())
.addContactPoints(hosts)
.withLocalDatacenter("1")
.withLocalDatacenter(datacenterName)
.build()) {
toreturn = cqlSession.execute(SchemaBuilder.dropKeyspace(keyspaceName).ifExists().build());
_log.info("Keyspace {} dropped.", keyspaceName);
@ -207,7 +207,7 @@ public class CassandraClusterConnection {
private void createTables(){
try (CqlSession cqlSession = configBuilder(CqlSession.builder())
.addContactPoints(hosts)
.withLocalDatacenter("1")
.withLocalDatacenter(datacenterName)
.withKeyspace(keyspaceName)
.build()) {

View File

@ -98,8 +98,10 @@ public class RunningCluster implements Serializable {
for (ServiceEndpoint res : resources) {
AccessPoint found = res.profile().accessPoints().iterator().next();
host = found.address();
datacenterName = found.description();
keyspaceName = found.name();
//datacenterName = found.description();
datacenterName="d4science_datacenter";
//keyspaceName = found.name();
keyspaceName="dev_keyspace";
}
}
} catch (Exception e) {