0

Two questions,

Lets say I have three cassandra nodes / environments setup, Node 1, Node 2 and Node 3.

where I specified the tokens for

Node 1 as 1 to 60, Node 2 as 61 to 120, Node 3 as 121 to 255.

1) As per the Cassandra documentation, for the partition key matching 1 to 60 it should be there in Node 1 but during replication this partition data of 1 to 60 is replicated to Node 2 and Node 3. So why do we need the partition separation in it? In this case, from which node the read happens for this partitioned data?

Next question, 2) If a node goes down, Will there be a RE-PARTITIONING between Cassandra nodes?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Harry
  • 3,072
  • 6
  • 43
  • 100

1 Answers1

3

1) Since number of nodes=replication factor the tokens won't matter as much. Depending on the balancing policy in your client the tokens can matter as to which node gets the request, e.g. TokenAwarePolicy.

2) Distribution of token ranges only happen when scaling your cluster.

Simon Fontana Oscarsson
  • 2,114
  • 1
  • 17
  • 20
  • So lets say we have data's in three nodes - Node 1 (primary data), Node 2 and Node 3 (replicated data's). If I have the Read Consistency as '1', From which node the read happens? – Harry Dec 01 '17 at 12:15
  • 1
    Depends on which balancing policy you use. http://docs.datastax.com/en/developer/java-driver/3.1/manual/load_balancing/ – Simon Fontana Oscarsson Dec 01 '17 at 12:18
  • I am pretty confused with the vNodes, Before vNodes, I can understand initial_token holds the value like token from 1 to 25 can reside in Node 1 and 26 to 50 can reside in Node 2, In this blog, It mentioned vNodes does auto partitioning, what does it mean ? https://www.datastax.com/dev/blog/virtual-nodes-in-cassandra-1-2 – Harry Dec 01 '17 at 12:23
  • I mean to be open with the question, how does it work in case of node addition and node deletion in the cluster? – Harry Dec 01 '17 at 12:26
  • 2 quick questions just turned into a dissertation... :) Anyhow, the partition key is hashed to give a token value with murmur3. The node that owns the token is primarily responsible for that data - data locality is established. Replica nodes have copies - redundancy and availability are established. Also no single point of failure. No master-slave. Writes are sent to all replicas at the same time. If you have other questions, please post another question to help future searchers. – LHWizard Dec 01 '17 at 14:26
  • You should create a new account on Datastax academy and watch all the videos in the DS201 course. All questions you've answered here are thoroughly explained there. More specifically you can start with this one to understand vnodes: https://academy.datastax.com/resources/ds201-foundations-apache-cassandra?unit=distributed-architecture-vnodes – Simon Fontana Oscarsson Dec 01 '17 at 14:31
  • @SimonFontanaOscarsson piece of cake for you : https://stackoverflow.com/questions/48002104/how-to-change-the-consistency-level-in-runtime-in-cassandra – Harry Dec 28 '17 at 05:43