开发者

List a complete column family using consistency quorum

开发者 https://www.devze.com 2023-04-13 06:31 出处:网络
I am a faily recent user of Cassandra. I went through the basics, setting up my schemas and plugging a java application to a database. Didn\'t run into any major problem putting together a sample app.

I am a faily recent user of Cassandra. I went through the basics, setting up my schemas and plugging a java application to a database. Didn't run into any major problem putting together a sample app. Now I started messing with down nodes and I'm stuck on the listing of the content of a column family.

I have 5 nodes, 127.0.0.1, 127.0.0.2, 127.0.0.3, 127.0.0.4, 127.0.0.5, and the datastax.com schema "demo", except that I used a replication_factor of 3 instead of one (I keeped the SimpleStrategy). I have 3 rows in the "users" column family (key "jsmith", "yomama" and "bobby开发者_StackOverflow社区jo").

Now I take down a node, either 2, 3 or 5 (I didn't touch 1 yet since it's my only seed), and I connect to 4, processing the following CQL query :

select Key, full_name, email, state, gender, birth_year from users;

AS expected, it gives me my 3 rows even with 1 node missing. So the next step is to ask for a consistent result.

select Key, full_name, email, state, gender, birth_year from users USING CONSISTENCY QUORUM ;

It fails. I couldn't figure it out. Having a replication factor of 3, I'm supposed to get away with a downed node. Now just for fun, I added a generic condition as follows

select Key, full_name, email, state, gender, birth_year from users USING CONSISTENCY QUORUM where KEY IN ('jsmith', 'bobbyjo', 'yomama') ;

And now I get my 3 rows using consistency quorum with one node down. Is it normal that I can't browse a complete column family using quorum with a downed node, but I can list all the rows anyway if I give cassandra their keys ?


A couple of questions:

  1. Did you start with 5 nodes and an RF of 3 or did you grow the cluster to 5?

  2. Did you try issuing the select statement which initially failed after issuing the one that worked? (If it works, you just saw read-repair in action - you may not have issued a 'nodetool repair' depending on your answer to #1 above).

  3. What version of Apache Cassandra, btw?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号