datastax-java-driver

Cassandra update fails silently with several nodes

末鹿安然 提交于 2019-12-12 18:19:55
问题 I have following situation. There is a CQL table (Cassandra 2.0.12) CREATE TABLE article ( version timeuuid, id timeuuid, active boolean, contentbody text, contentformat text, createdat text, entitytype text, externalsources list<text>, geolat double, geolong double, lastcomments list<text>, lastmodifiedat text, lstmodbyuserid text, lstmodbyusername text, previewimage text, publishedatarticle text static, publishedatver text, status text, subcategory text, subtitle text, title text, userid

User Defined Type (UDT) behavior in Cassandra

不羁的心 提交于 2019-12-12 09:19:05
问题 if someone has some experience in using UDT (User Defined Types), I would like to understand how the backward compatibility would work. Say I have the following UDT CREATE TYPE addr ( street1 text, zip text, state text ); If I modify "addr" UDT to have a couple of more attributes (say for example zip_code2 int, and name text): CREATE TYPE addr ( street1 text, zip text, state text, zip_code2 int, name text ); how does the older rows that does have these attributes work? Is it even compatible?

How to keep 2 Cassandra tables within same partition

北战南征 提交于 2019-12-12 07:59:26
问题 I tried reading up on datastax blogs and documentation but could not find any specific on this Is there a way to keep 2 tables in Cassandra to belong to same partition? For example: CREATE TYPE addr ( street_address1 text, city text, state text, country text, zip_code text, ); CREATE TABLE foo ( account_id timeuuid, data text, site_id int, PRIMARY KEY (account_id) }; CREATE TABLE bar ( account_id timeuuid, address_id int, address frozen<addr>, PRIMARY KEY (account_id, address_id) ); Here I

How to set up Cassandra client-to-node encryption with the DataStax Java driver?

回眸只為那壹抹淺笑 提交于 2019-12-12 07:57:46
问题 I've set up node-to-node encryption on my Cassandra cluster. Now I want to set up client-to-node. According to this documentation, it should be as easy as taking the SSL certificate of my client and importing it into every node's truststore. I don't have such a certificate yet but this is not my question. Since my client is using the DataStax Java driver, it seems that in order to enable SSL from the client side, when I am building the Cluster I should use the withSSL() method to enable SSL.

InvalidQueryException when trying to create column family in Cassandra via unit

你。 提交于 2019-12-12 06:08:27
问题 I have a 3 node cassandra cluster and via my unit test in Java, I first create a keyspace and then create a column family within that keyspace. Sometimes the unit tests passes but randomly I keep getting the following error. I am using the latest datastax 2.1.4 java driver and the cassandra version in 2.1.0. com.symc.edp.database.nosql.NoSQLPersistenceException: com.datastax.driver.core.exceptions.InvalidQueryException: Cannot add column family 'testmaxcolumnstable' to non existing keyspace

Cassandra returns variable results when looking for time series data

人盡茶涼 提交于 2019-12-12 04:34:14
问题 When I give this query in DataStax DevCenter, 2 rows are returned. The rows returned are foe Dec 30th as they should be. SELECT * FROM abc.alerts_by_type_and_timestamp WHERE alert_type IN ('Permanent Fault', 'Temporary Fault') AND alert_timeStamp >= '2015-12-30T15:00+0000' AND alert_timeStamp <= '2015-12-31T15:00+0000' But running in PreparedStatement like this SELECT * FROM abc.alerts_by_type_and_timestamp WHERE alert_type IN :alertTypes AND alert_timeStamp >= :minTimestamp AND alert

Cassandra Accessor / Mapper not mapping udt field

北城余情 提交于 2019-12-12 03:53:48
问题 I am using datastax cassandra 3.1.2. I have created the following table in cassandra and inserted a record. CREATE TYPE memory ( capacity text ); create TABLE laptop ( id uuid primary key, model text, ram frozen<memory> ); select * from laptop ; id | model | ram --------------------------------------+---------------+------------------- e55cba2b-0847-40d5-ad56-ae97e793dc3e | Dell Latitude | {capacity: '8gb'} When I am trying to fetch the capacity field from frozen type memory in Java using

Can't connect to local cassandra via java driver

谁说我不能喝 提交于 2019-12-12 03:04:12
问题 (neophyte question) I've just installed cassandra 3.5 (on linux, using the generic package). At present, it's a completely vanilla installation - I haven't modified the conf file and haven't created or added anything yet. I can connect using cqlsh but not using the javax java driver (version 2.0.2). E.g. if I run BasicConfigurator.configure(); Cluster cluster = Cluster.builder().addContactPoint("127.0.0.1").build(); System.out.println("\nCluster name: " + cluster.getClusterName()+"\n");

use datastax java driver to bind data for where in clause

流过昼夜 提交于 2019-12-12 02:55:22
问题 I know somebody has ask this question (http://www.datastax.com/support-forums/topic/java-driver-cql-3-bound-statements-in-clause#post-13114, Prepared Statement with collection in IN clause in Datastax Cassandra CQL driver) However, I still do not know how to bind data. for example, my preparedStatement is select * from cf where key in (?) What I want is bind data and the cql is looks like select * from cf where key in ('key1', 'key2') Now I have a boundStatement. when I use boundStatment.bind

Cassandra: Truncating a table twice throws consistency exception

筅森魡賤 提交于 2019-12-12 02:37:38
问题 I have a scalatest suite that's failing, and I have narrowed the cause down to the code that runs before tests and truncates a data table. If I run the following code I can recreate the problem session.execute(s"TRUNCATE ${dao.tableName};") session.execute(s"TRUNCATE ${dao.tableName};") Throws: Error during truncate: Cannot achieve consistency level ALL com.datastax.driver.core.exceptions.TruncateException: Error during truncate: Cannot achieve consistency level ALL at com.datastax.driver