hector

How to list all column names in a column family in Cassandra?

大城市里の小女人 提交于 2019-12-04 10:02:46
I'm using Cassandra, and I want to make a data browser which shows the contents of any column family. I need to get the column names to configure a UI grid. Is it possible to collect the names of columns in all rows? The best way, if you are using Cassandra 1.1: SELECT column_name FROM system.schema_columnfamilies WHERE keyspace_name = X AND columnfamily_name = Y See also http://www.datastax.com/dev/blog/schema-in-cassandra-1-1 There are several parts to this answer. First, to answer your specific question, you should use a sliceQuery to get all of the columns in a row. Pass an empty

Cassandra server throws java.lang.AssertionError: DecoratedKey(…) != DecoratedKey

自作多情 提交于 2019-12-04 09:50:13
问题 I'm currently experimenting around with Cassandra. On the client-side (with Hector) I look up a few keys like this: ColumnFamilyResult<String, String> result = template.queryColumns(Arrays.asList("key1","key2","key3")); Most of the time it seems to work. But other times I get a timeout exception on the client: Caused by: me.prettyprint.hector.api.exceptions.HTimedOutException: TimedOutException() at me.prettyprint.cassandra.service.ExceptionsTranslatorImpl.translate(ExceptionsTranslatorImpl

How to use cql queries to get different datatypes out of cassandra with java client hector

自古美人都是妖i 提交于 2019-12-03 12:41:30
I'm new to cassandra and hector so i'm trying to execute cql queries but the problem is that not all columns are of type string so how dow I execute the query "select * from users"? My column family looks like this: UPDATE COLUMN FAMILY users WITH comparator = UTF8Type AND key_validation_class=UTF8Type AND column_metadata = [ {column_name: full_name, validation_class: UTF8Type} {column_name: email, validation_class: UTF8Type} {column_name: state, validation_class: UTF8Type, index_type: KEYS} {column_name: gender, validation_class: UTF8Type} {column_name: birth_year, validation_class: LongType,

Health check for Cassandra connection (using hector)?

[亡魂溺海] 提交于 2019-12-03 11:21:03
For operations monitoring of my application, I am looking for something similar to the commonly used "SQL connection validation" query SELECT 1; in Cassandra, using the Hector driver. I have tried things like looking at Cluster.getKnownPoolHosts() and .getConnectionManager().getActivePools(). But it seems that their status is not continuously updated, only when I actually try to access Cassandra with a query. I'd like my health check to be independent of any keyspaces or user CFs that need to exist, so just running a "dummy" query seems difficult (against what?). And of course it shouldn't

How to define composite key for a column family and then reference it using Hector?

社会主义新天地 提交于 2019-12-03 08:57:01
where can I find samples for this? Most of my code using ColumnFamilyTemplate to do CRUD on the data records, see below. Once I have the composite key defined, can I still use ColumnFamilyTemplate to access my data having composite keys? private static final ColumnFamilyTemplate<UUID, String> template = new ThriftColumnFamilyTemplate<UUID, String>( Bootstrap.keyspace, "User", UUIDSerializer.get(), StringSerializer.get(), HFactory.createMutator(Bootstrap.keyspace, UUIDSerializer.get())); It shouldn't matter which API you use to do the CRUD on the records; CompositeType (or DynamicCompositeType)

Cassandra server throws java.lang.AssertionError: DecoratedKey(…) != DecoratedKey

断了今生、忘了曾经 提交于 2019-12-03 04:09:18
I'm currently experimenting around with Cassandra. On the client-side (with Hector) I look up a few keys like this: ColumnFamilyResult<String, String> result = template.queryColumns(Arrays.asList("key1","key2","key3")); Most of the time it seems to work. But other times I get a timeout exception on the client: Caused by: me.prettyprint.hector.api.exceptions.HTimedOutException: TimedOutException() at me.prettyprint.cassandra.service.ExceptionsTranslatorImpl.translate(ExceptionsTranslatorImpl.java:35) at me.prettyprint.cassandra.service.template.ThriftColumnFamilyTemplate$1.execute

Hector & Cassandra issue NoSuchFieldError: DEFAULT_MEMTABLE_THROUGHPUT_IN_MB

旧时模样 提交于 2019-12-02 08:41:34
问题 I'm testing the connection to Cassandra Database over Hector. But when I run the Junit Tests I constanly get following message: java.lang.NoSuchFieldError: DEFAULT_MEMTABLE_THROUGHPUT_IN_MB Does somebody know what I do wrong? Thanks for your help, Chris ------------------------------------------------------------------------------- Test set: com.acolsolutions.trademaniac.CreateSchemaTest ------------------------------------------------------------------------------- Tests run: 1, Failures: 0,

Hector & Cassandra issue NoSuchFieldError: DEFAULT_MEMTABLE_THROUGHPUT_IN_MB

我们两清 提交于 2019-12-02 07:42:05
I'm testing the connection to Cassandra Database over Hector. But when I run the Junit Tests I constanly get following message: java.lang.NoSuchFieldError: DEFAULT_MEMTABLE_THROUGHPUT_IN_MB Does somebody know what I do wrong? Thanks for your help, Chris ------------------------------------------------------------------------------- Test set: com.acolsolutions.trademaniac.CreateSchemaTest ------------------------------------------------------------------------------- Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.287 sec <<< FAILURE! testAddDropKeyspace(com.acolsolutions

Timestamp / date as key for cassandra column family / hector

浪尽此生 提交于 2019-12-01 08:23:56
问题 I have to create and query a column family with composite key as [timestamp,long]. Also, while querying I want to fire range query for timestamp (like timestamp between xxx and yyy) Is this possible ? Currently I am doing something really funny (Which I know its not correct). I create keys with timestamp string for given range and concatenate with long. like , 1254345345435-1234 3423432423432-1234 1231231231231-9999 and pass set of keys to hector api. (so if i have date range for 1 month and

Cassandra querying on a part of a key

喜夏-厌秋 提交于 2019-12-01 05:16:53
问题 I have a cassandra column family which has a row key like 2012-09-30-05-42-00:30:5856869 I need to query some thing like select * from cf where key like %5856869% Currently I am using Astyanax , is same possible in astyanax. If not, which implementation would support it. 回答1: LIKE queries are not supported in Cassandra. If you want to query based on part of a key, you'll want to use composite keys. But in this specific case, the 5856869 portion of the key would have to be the first part for