hector

How to get sorted counters from Cassandra

a 夏天 提交于 2019-12-06 05:26:38
问题 I have a row of counters and I want to get its' columns sorted by values. Is there any strategies or data models for that? 回答1: I'm afraid there is no way of having Cassandra do this for you; you will need to get the entire row from Cassandra (paging for large rows) and sort it in the client. You could use a periodic MapReduce job to do this for you, and cache the result of the job back into Cassandra, if your solution can cope with non-uptodate results. 来源: https://stackoverflow.com

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

落爺英雄遲暮 提交于 2019-12-06 05:02:42
问题 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? 回答1: 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 回答2: There are several parts to this answer. First, to

Does Hector provide APIs to support composite key?

核能气质少年 提交于 2019-12-06 04:36:28
Right now, I have to manually generate the composite key by formatting the subkeys together. It's ugly and not efficient. I wonder if Hector provides such set of APIs to handle composite keys in a more decent way. yes it does. You can look at DynamicCompositeTest for examples: https://github.com/rantav/hector/blob/master/core/src/test/java/me/prettyprint/hector/api/beans/DynamicCompositeTest.java @Test public void allTypesSerialize() { DynamicComposite composite = new DynamicComposite(); UUID lexUUID = UUID.randomUUID(); com.eaio.uuid.UUID timeUUID = new com.eaio.uuid.UUID(); //add all forward

How to cleanup embedded cassandra after unittest?

一笑奈何 提交于 2019-12-05 20:15:53
I'm using Hectors EmbeddedServerHelper to set up embedded Cassandra. It has teardown() and cleanup() methods. The problem is that cleanup method cannot delete some commit log files created by cassandra. Probably because there are still some cassandra daemons that were not properly shut down by the teardown() method. Here us the setup and teardown code: @BeforeClass public static void setUpBeforeClass() throws Exception { EmbeddedServerHelper sh = new EmbeddedServerHelper(); sh.setup(); } @AfterClass public static void tearDownAfterClass() throws Exception { EmbeddedServerHelper.teardown();

Hector (Cassandra) Delete Anomaly

南笙酒味 提交于 2019-12-05 07:57:47
Using hector (cassandra client) when I try to do delete, it deletes the columns…but leaves the row key behind…does anyone know why, and how can I delete that row key as well ? This is expected when using Cassandra. Since it deletes by writing tombstones the data is still there until the next compaction. Eventually it will go a way completely, but your application code must be aware that an empty row is the same as a deleted row. Patricio Actually, it will go away in the next compaction that happens after the grace period for that row. Check this out: Wikipedia 来源: https://stackoverflow.com

Hector to get the resulting counter value after doing incrementCounter

夙愿已清 提交于 2019-12-05 06:49:55
We are doing the following to update the value of a counter, now we wonder if there is a straightforward way to get back the updated counter value immediately. mutator.incrementCounter(rowid1, "cf1", "counter1", value); Wildfire There's no single 'incrementAndGet' operation in Cassandra thrift API. Counters in Cassandra are eventually consistent and non-atomic. Fragile ConsistencyLevel.ALL operation is required to get "guaranteed to be updated" counter value, i.e. perform consistent read. ConsistencyLevel.QUORUM is not sufficient (as specified in counters design document: https://issues.apache

Availability of Cassandra

℡╲_俬逩灬. 提交于 2019-12-05 04:48:38
I am running into an issue "me.prettyprint.hector.api.exceptions.HUnavailableException: : May not be enough replicas present to handle consistency level." when I have RF=1, Read Consistency Level = 1 and one of the nodes in 6 node ring/ cluster is down. All of my reads are failing with this exception. Any idea? Ideally only reads that are looking for data in the node which is down should fail and all other reads should be successful? There could be a few possibilities: You're running a multi-row query (get_range, get_indexed_slices, multiget, or the cql equivalents) that requires multiple

Cassandra and Secondary-Indexes, how do they work internally?

a 夏天 提交于 2019-12-05 01:39:56
How does a Cassandra Secondary-Index work internally? The docs state it is some kind of Hash Index: Given i have the colum username="foobar" (Column username will be scondary index) in a CF User with RandomOrderingPartitioner Is my asumption correct, that cassandra uses a "Distributed Hash Index" (=so the index is not on one single node=the index is splitted)? On how many nodes are the index-parts held (the same amout as the replicatio factor)? On which nodes are the index-parts held (does Cassandra split the index by the same logic as the key with RandomOrderingPartitioner)? In case the index

Health check for Cassandra connection (using hector)?

天涯浪子 提交于 2019-12-04 17:39:15
问题 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

How to get sorted counters from Cassandra

和自甴很熟 提交于 2019-12-04 10:05:22
I have a row of counters and I want to get its' columns sorted by values. Is there any strategies or data models for that? I'm afraid there is no way of having Cassandra do this for you; you will need to get the entire row from Cassandra (paging for large rows) and sort it in the client. You could use a periodic MapReduce job to do this for you, and cache the result of the job back into Cassandra, if your solution can cope with non-uptodate results. 来源: https://stackoverflow.com/questions/8428364/how-to-get-sorted-counters-from-cassandra