Kassandra - how to get all the keys in CF (Random Partitioner)

I am using Random Partitioner (cassandra version 0.7.8), I want to get all the keys in CF. I am trying to use get_range_slices for this, and it looks like I can get the keys using this method, although the keys are not ordered.

And there is also a message: "This is allowed with any separator in 0.6" ( Retrieving all keys using the Cassandra API is an analogy with "SELECT id FROM table"; " ), but the api document states that this is not possible ( http: // wiki .apache.org / cassandra / API # get_range_slices ).

My question is: is it correct to use get_range_slices in Random Partitioner ? Is there an official document confirming this?

+6
source share
2 answers

Yes it is possible. In the above documentation, you are trying to say that if you have the row keys 1..10, and you request a range of 5..8, you will not get a rowset [5, 6, 7, 8].

This is the documentation for fetching all rows from a column family .

Mostly you use get_range_slices with a blank start_key and no end_key. Depending on the number of rows specified in the counter, this may result in fewer all rows in the column family. In this case, you use the last row key from the previous result set as start_key for the next query.

+6
source

Here is an example of this in Java with a Hector client (with multiple threads): https://github.com/zznate/cassandra-tutorial/blob/master/src/main/java/com/datastax/tutorial/KeyIteratorExample.java

+2
source

Source: https://habr.com/ru/post/907202/


All Articles