astyanax

Is it possible to run CQL3 queries “create table”, “insert into” with Astyanax?

痴心易碎 提交于 2020-01-17 14:06:38
问题 For now I have found just "select" examples. Or is it possible to do with e.g. MutationBatch? MutationBatch m = keyspace.prepareMutationBatch(); ColumnListMutation<String> cfmStandard = m.withRow(MY_CF, ...); my column family is: CREATE TABLE my_cf ( ... key text, ... timeid timeuuid, ... flag boolean, ... data text, ... PRIMARY KEY (key, timeid)); 回答1: worked for inserts and create: keyspace.prepareQuery(MY_CF).withCql(queryBuilder.toString()).execute(); 来源: https://stackoverflow.com

setMaxConns and setMaxConnsPerHost in Astyanax client

可紊 提交于 2019-12-25 06:15:08
问题 I am using Astyanax client to read the data from Cassandra database . I have a single cluster with four nodes . I am having replication factor of 2 . I am trying to understand what is the difference between setMaxConns and setMaxConnsPerHost methods in Astyanax client? I cannot find proper documentation on this. I have a Multithreaded code which which spawn multiple threads and then create the connection to Cassandra database only once (as it is a Singleton) and then keep on reusing for other

Astyanax: If a MutationBatch fails halfway, what guarantees do I have?

断了今生、忘了曾经 提交于 2019-12-24 02:16:32
问题 I know that as of 0.8, Cassandra guarantees that row updates are atomic. However, if I prepare (using MutationBatch) several row modifications or modifications across several column families, is it guaranteed that the rows will be updated in the order that in which I set them up? e.g. If I have Update CF 1, Row 1 Update CF 1, Row 2 Update CF 2, Row 3 is it possible for CF 2 to be updated while CF 1 remains unchanged due to failure? What happens if I had set up: Update CF 1, Row 1, Column A

Dependency trouble using CassandraUnit with Astyanax

落爺英雄遲暮 提交于 2019-12-23 16:44:39
问题 I have a SessionDaoCassandraImpl class that reads data from Cassandra using Astyanax that I would like to test with an embedded Cassandra server. CassandraUnit seems perfect to do so but I am running into an exception ERROR - 2012-11-21 14:54:34,754 - AbstractCassandraDaemon.activate(370) | Exception encountered during startup java.lang.NoSuchMethodError: com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap$Builder.maximumWeightedCapacity(I)Lcom/googlecode/concurrentlinkedhashmap

Cassandra updates not working consistently

感情迁移 提交于 2019-12-22 10:20:14
问题 I run the following code on my local (mac) machine and on a remote unix server.: public void deleteValue(final String id, final String value) { log.info("Removing value " + value); final Collection<String> valuesBeforeRemoval = getValues(id); final MutationBatch m = keyspace.prepareMutationBatch(); m.withRow(VALUES_CF, id).deleteColumn(value); try { m.execute(); } catch (final ConnectionException e) { log.error("Unable to delete location " + value, e); } final Collection<String>

Cassandra Client Java API's [closed]

旧巷老猫 提交于 2019-12-17 15:22:58
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I have recently started working with Cassandra Database. Now I am in the process of evaluating which Cassandra client we should go forward with. I have seen various post on stackoverflow about which client to use for Cassandra but none has very definitive answer. My team has asked me to do some research on this

Upsert data into Cassandra database using Astyanax client

微笑、不失礼 提交于 2019-12-13 20:08:23
问题 Problem Statement:- I am trying to insert data into Cassandra database. I am using Netflix/Astyanax client for this. Below is the code which will upsert data into Cassandra database using Astyanax client . In my below method, it accepts two parameter. One is the userId which I will be using as the RowKey and attributes map which will contain, column name as the key and it's column value as the value in the map. Now how can I use Astyanax client to upsert data into Cassandra database using the

Astyanax getKey with compound key

╄→гoц情女王★ 提交于 2019-12-13 04:33:54
问题 I would like to run the following code with a compound primary key. Column<String> result = keyspace.prepareQuery(CF_COUNTER1) .getKey(rowKey) .getColumn("Column1") .execute().getResult(); Long counterValue = result.getLongValue(); Research seems to show that it can be a string that represents a key (if it's not a compound primary key). The documentation says that it is of type K , alas, I am not very experience with Java, and have no idea what that means. Is it just a base type that lots of

Astyanax Cassandra Double type precision

自作多情 提交于 2019-12-12 10:47:43
问题 I'm trying to get a Double value from a Cassandra table with a double type column. I've created the table in CQL3 syntax: CREATE TABLE data_double ( datetime timestamp, value double, primary key (datetime) ); I've inserted a row: INSERT INTO data_double (datetime, value) VALUES ('111111111', 123.456); When I do: SELECT * from data_double; I get that the value is 123.46 Why is the value rounded? Thanks 回答1: The cqlsh utility by default will only display 5 digits of precision for floating point

Composite Column Values in Cassandra?

落花浮王杯 提交于 2019-12-12 01:14:48
问题 Can we have a composite values in each columns in Cassandra Column Family? user-id column1-name 123 (Column1-Value Column1-SchemaName Column1-LastModifiedDate) userId is the rowKey here. And same thing will be for other columns as well. Each column value will contain below three things always- ByteType for Column-Value UTF8Type for Column-SchemaName DateType for LastModifiedDate If yes, can anyone help me in designing the column family for this? I will be using Astyanax client to insert into