spring-data-cassandra

Setting Query level consistency for Cassandra using Spring data

假如想象 提交于 2019-12-13 03:51:26
问题 We are setting up consistency level, LOCAL_QUORUM as default. We are using this at the time of Cluster building in config - Cluster.builder().addContactPoints(environment.getProperty("cassandra.contact-points").split(",")).withPort(port) .withQueryOptions( new QueryOptions().setConsistencyLevel(ConsistencyLevel.valueOf(environment.getProperty("cassandra.consistency-level"))) .setSerialConsistencyLevel(ConsistencyLevel.valueOf(environment.getProperty("cassandra.consistency-level"))))

Spring Data Cassandra codec not found for requested operation set<varchar> <-> java.util.Set

邮差的信 提交于 2019-12-13 03:14:36
问题 My entity has a field @Column("authorizations") @Builder.Default private Map<String, Set<String>> authorizations = new HashMap<>(); When I query for that object via Spring Data repository I'm getting an exception CodecNotFoundException: Codec not found for requested operation: [set <-> java.util.Set] Writes work just fine though. I can't believe this is not supported out of the box. Table definition CREATE TABLE resource_authorization_rules( resource text, region text, authorizations map<text

How to load spring application context even if Cassandra down

雨燕双飞 提交于 2019-12-13 02:13:52
问题 When using @Configuration @EnableCassandraRepositories(basePackages={"com.foo"}) public class CassandraConfig{ @Bean public CassandraClusterFactoryBean cluster() { final CassandraClusterFactoryBean cluster = new CassandraClusterFactoryBean(); cluster.setContactPoints(nodesRead); cluster.setPort(port); return cluster; } Where in the com.foo package there is a interface that extends CrudRepository . Is there a way to make it so that at startup time an exception is not thrown if the database is

Run Query against multiple namespaces with Spring Data Cassandra

♀尐吖头ヾ 提交于 2019-12-13 00:04:32
问题 Is there any way in which using Spring Data a query can be executed on all keyspaces in Cassandra? 回答1: There are two parts to this answer: When using Spring Data Cassandra 1.x, you are need to setup individual CassandraTemplate instances for each keyspace you want to use. With Spring Data Cassandra 2.x, we introduced the SessionFactory interface to control which Session to use. We ship with routing SessionFactory support so you can provide multiple sessions and a discriminator (usually

UserTypeResolver must not be null

℡╲_俬逩灬. 提交于 2019-12-12 11:14:54
问题 I have been attempting to test out an insert of a Cassandra UDT, and i keep running into the following error: Exception in thread "main" java.lang.IllegalArgumentException: UserTypeResolver must not be null After just trying to figure my own way through it, i attempted to exactly replicate the approach outlined in the following: User Defined Type with spring-data-cassandra However, i still get the same error. I am able to insert to the target DB when i remove the UDT and just insert the

creating uuid type field in Cassandra table using CassandraAdminOperations.createTable

六月ゝ 毕业季﹏ 提交于 2019-12-12 06:23:23
问题 I have problem when create table with UUID type field using CassandraAdminOperations.createTable. I defined field in table with type uuid, but when the table was created using CassandraAdminOperations.createTable, the field was created as timeuuid. Is there any way to force the field to uuid instead of timeuuid ? Here is the field definition in class, @PrimaryKeyColumn(name = "id", ordinal = 0, type = PrimaryKeyType.PARTITIONED) private UUID id; @Column(value = "url") private String url; But

How to Query Cassandra using CassandraRepository with Spring Data Cassandra and Spring Boot?

≡放荡痞女 提交于 2019-12-12 01:53:50
问题 I have a Table in my Cassandra Cluster built using these commands: CREATE KEYSPACE IF NOT EXISTS activitylogs WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes = true; CREATE TABLE IF NOT EXISTS activitylogs.activities2 ( activity_id timeuuid, actor_id text, app_id text, item_id text, viewer_id text, activity_type int, ts timestamp, PRIMARY KEY (actor_id, activity_id, app_id) ) WITH CLUSTERING ORDER BY (activity_id DESC, app_id ASC); This is what my

Max length of varchar / text in cassandra

Deadly 提交于 2019-12-11 13:48:20
问题 I am trying to find the answer to a simple question. Let say I have a table which I store content in it. The content is just a string. I am trying to find what is my max length for this specific one? I was reading that "text" type is just an alias to varchar. Is varchar length only 255 or it can be more? 回答1: You can use TEXT column in your database ( about 64KB characters). As you know String in java has 2^31-1 characters 来源: https://stackoverflow.com/questions/37290391/max-length-of-varchar

Cassandra Repository is always using keyspace from application.properties file not from the extended class of AbstractCassandraConfiguration

主宰稳场 提交于 2019-12-11 12:38:08
问题 I have my data are on different keyspaces, i have more than one keyspace in a spring boot application, so i want my cassandra repositories to be configurable with different keyspaces each rather than having one keyspace in application level. In a spring project, i am looking something like a keyspace should be configurable at Repository level. Cassandra Repository is always using keyspace from application.properties file, Not working if i extend AbstractCassandraConfiguration class and

Cassandra Datastax Optimal PoolingOptions

ぃ、小莉子 提交于 2019-12-11 04:44:59
问题 I'm Working on a spring/java webapp using cassandra as backend; the app would be used by potentially hundreds of customers simultaneously. I see that default Cluster PoolingOptions connection pool settings (With protocol v3) are: LOCAL hosts: core = max = 1 REMOTE hosts: core = max = 1 And default maxRequestsPerConnection setting (With protocol v3) is: 1024 for LOCAL hosts, and 256 for REMOTE hosts. Will these default settings be sufficient to fulfill our usage requirements? If not, What