Unable to connect to multiple astradb keyspaces from springboot microserviec - spring-boot

I am new to casasndra and using astradb on aws + springboot as microsrvice (its monolith as of yet). As we quickly reached 200 tables for one keyspace for our application, we are thinking of using multiple keyspaces for multiple modules. Also there is one limitation of using storage index (50 sai per db). Need help to get details about how do I access multiple keyspaces for my spring boot app ?
using org.springframework.boot:spring-boot-starter-data-cassandra
I am using below configurations:
application.yml
astra:
api:
application-token: <your_token>
database-id: <your_db_id>
database-region: <your_db_region>
cql:
enabled: true
download-scb:
enabled: true
driver-config:
basic:
session-keyspace: <your_keyspace>

Related

How to save data in Hazelcast with more then one kubernetes cluster

There are lot of tutorials how to use Hazelcast with spring boot in kubernetes for example
Problem is we have 2 data centers, A and B. In both there of these data centers there is kubernetes cluster with application and hazelcast cluster. So the question is how should I configure configure application in data center A to save data in both cluster (A is easy according to tutorial) but how to also configure hazelcast in second cluster ?
You can solve this problem on two layers:
1. Application layer - Your application can store the data in multiple Hazelcast clusters. If you use Hazelcast with Spring Data, then you can configure multiple databases with Spring JPA. Note however that when your application stores the data in the data centre that is in a different region, then the latency will suffer significantly
2. Hazelcast layer - Hazelcast clusters propagate the data changes across multiple data centres using geo-replication (Hazelcast WAN Replication, Enterprise feature); then you connect your application to on Hazelcast cluster only, the one that is co-located with your application.

Jetty Spring Boot with session replication

I am using spring boot 2.5.3 with Jetty 9.4.43.v20210629. I want to share the session across multiple nodes. In Jetty 9.4 there are lot of changes in session management. I want some reference materials for session replication (using JDBC / File system) with java configurations.
Session replication can be done using spring session with following storage options,
Hazlecast
Database
Redis
MongoDB
spring.session.store-type property should be used to decide the storage type. When multiple nodes / containers point to same storage it will share the session and no need to maintain a sticky session.
Need to add proper dependencies in pom.xml and add annotations when required (ex: #EnableJDBCHttpSession)
sample application yaml changes.
JDBC
spring:
application.name: console-bs
main.allow-bean-definition-overriding: true
profile: default
session.store-type: jdbc
session.jdbc.initialize-schema: always
jpa.database: mysql
jpa.database-platform: org.hibernate.dialect.MySQL5Dialect
datasource.url: jdbc:mysql://mysqldb:3306/user
datasource.username: user
datasource.password: user1234#
datasource.driver-class-name: com.mysql.cj.jdbc.Driver
Redis
spring:
application.name: console-bs
main.allow-bean-definition-overriding: true
profile: default
session.store-type: redis
redis.host: redis
redis.port: 6379

Is it feasible to use database-per-tenant with 1000 tenants?

I would like to build a multi tenant Spring Boot application. I prefer persisting the data for every tenant in a separate database.
This approach implies the usage of a data source (and a connection pool) for each tenant/database.
In my scenario I have about 1000 tenants. Does anyone have experience with having 1000 connection pools in a Spring Boot application?
What do you recommend for such a scenario?
Thanks!

How to connect to several cassandra clusters at same time with Spring Boot Starter Data Cassandra

I need to connect to different cassandra clusters depended on input data. I have idea how to achieve that with manually creating cassandraTemplate for each cluster. but what about spring-boot-starter-data-cassandra? Does it allow achieve same behavior?

Spring Boot (Spring Data JPA) - configure PostgreSQL Read Replicas

What is the simplest way to configure read replicas with Spring Boot and Spring Data JPA? I'm searching a lot and cannot find solution.
AWS RDS Aurora Postgresql gives 2 endpoints:
master (write)
replicas (read)
I want to configure my application to use this endpoints.
Why do you need to configure the read replica with Spring Boot, I am guessing that you just need to connect with the read replica, right?
Have you looked the aws sdk for java?
You need to look over a class there named DescribeDBClusterEndpointsResult.

Resources