Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

rachit.sharma1989@gmail.com avatar image
rachit.sharma1989@gmail.com asked Erick Ramirez answered

How can we create two separate clusters from the same Spring Boot application?

Being a newbie, having hard time in connecting to two different clusters from spring boot application. Task is to get the data from cassandra on ec2(I am able to do that) and insert in batches in AWS keyspace.

Here I am overriding the customize method and when trying to connect to cassandra ec2 cluster things working fine but also need to have one more cluster for connecting to AWS Keyspaces(select data from cassandra and insertion needs to happen in AWS Keyspace).

Problem is - When I am overriding the customize method for creating cluster for AWS Keyspace, instead of new cluster creation contact point gets added to previously created cluster.

Any help would be highly appreciated. Thanks!

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<dependency>
 <groupId>org.springframework.boot</groupId>
 <artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
 <groupId>org.springframework.boot</groupId>
 <artifactId>spring-boot-starter-data-cassandra</artifactId>
</dependency>
@Component
public class CassandraClusterConfig implements ClusterBuilderCustomizer {
 @Override
  public void customize(Cluster.Builder clusterBuilder) {
  
cassandra-driver.version = 3.6.0
<dependency>
 <groupId>com.datastax.cassandra</groupId>
 <artifactId>cassandra-driver-extras</artifactId>
 <version>${cassandra-driver.version}</version>
</dependency>

<dependency>
 <groupId>com.datastax.cassandra</groupId>
 <artifactId>cassandra-driver-mapping</artifactId>
 <version>${cassandra-driver.version}</version>
</dependency>
spring-bootunsupportedaws keyspaces
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered

As you may or may not be aware, DataStax has its own Cassandra-as-a-service offering called Astra DB.

Given that AWS Keyspaces is a competing service, we don't provide support for it and we suggest that you contact AWS instead. Cheers!

Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.