hector

Multiple database queries in parallel, for a single client request

时光总嘲笑我的痴心妄想 提交于 2019-12-10 14:48:10
问题 To complete certain requests from the user, in my application, I am issuing multiple DB queries from a single method, but they are currently being executed sequentially & thus the application is blocked until the time it has received the response/data for the previous query, then proceeding to next query. This is not something I like much. I would like to issue parallel queries. Also after issuing queries I would like to do some other work, (instead of being blocked till previous queries

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

回眸只為那壹抹淺笑 提交于 2019-12-10 02:13:45
问题 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 Hector: How to do a MultigetSliceQuery with indexed columns?

不羁的心 提交于 2019-12-09 20:43:07
问题 Is it possible to perform a MultigetSliceQuery while using conditions on indexed columns like with a IndexedSlicesQuery. In other words, an IndexedSlicesQuery performed on a specific set of keys. The way I found to do this is by first performing a MultigetSliceQuery on a set of keys and then filter the results in the application code. But can Cassandra do it for me? 回答1: No, the only options for IndexedSlicesQuery are setting the startKey and rowCount , so 2 phased filter would be the only

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

走远了吗. 提交于 2019-12-09 06:52:32
问题 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())); 回答1:

Is TTL for Cassandra counter column family supported?

北慕城南 提交于 2019-12-08 17:14:17
问题 Does Cassandra support TTL for the Counter column family? Specifically we use Hector as a client to Cassandra and I didn't find any API receiving TTL as a parameter. At least HFactory.createCounterColumn doesn't have TTL argument. 回答1: No. TTL expiration does not exist for counter columns. See CASSANDRA-2103 for background on why this feature doesn't make sense for Cassandra counter columns. 来源: https://stackoverflow.com/questions/19752308/is-ttl-for-cassandra-counter-column-family-supported

Hector/Cassandra: How do I add a Column to an existing SuperColumn?

隐身守侯 提交于 2019-12-08 14:26:09
问题 I can create a new SuperColumn that has Columns - no problem. I can create a new Column - no problem. But how do I add a new Column to an existing SuperColumn? 回答1: But how do I add a new Column to an existing SuperColumn? You should really look into the class SuperCfTemplate and class SuperCfUpdater in hector. Once they are initialize, do what is needed (example in your question, add a new cf within this scf), then update the changes using the template. Below are a snippet. SuperCfTemplate

How to cleanup embedded cassandra after unittest?

倖福魔咒の 提交于 2019-12-07 17:45:37
问题 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(); }

Does Hector provide APIs to support composite key?

我的梦境 提交于 2019-12-07 11:54:47
问题 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. 回答1: 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();

Hector to get the resulting counter value after doing incrementCounter

房东的猫 提交于 2019-12-07 03:25:28
问题 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); 回答1: 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.

How to access the local data of a Cassandra node

故事扮演 提交于 2019-12-06 14:00:46
问题 From what little understanding of Cassandra I have, it seems that data locality is mostly transparent to the client application that accesses a node, as it should. However, what if I explicitly only wanted to access the data of a column family that is local to the node I'm connected to? Is such a thing possible? I haven't found a way of getting this from a client API out-of-the-box, but it seems that I could get some of this information through the system tables, but I can't quite figure out