Posts

Node

Image
  Apache Cassandra Node But as the load on single node increases node gets to crack We just add more nodes to the ring   Data is distributed evenly across the ring nodes Each node is assigned a token range   How does cassandra retrieve the data from the correct node ? Query using partition key only:   When we query data using partition key   eg: select * from users where user_id=1234;   Cassandra takes the partition key and calculates the hash value using default Murmur3 algorithms   Calculated hash value of the partition key is the Token. Cassandra takes the token and identifies which node can handle this token range. Once cassandra identifies the node it sends the query , if we have replication factor then it sends to multiple nodes depends on the replication factor and consistency level.   Once data is retrieved from the multiple nodes then it checks which replica node has the latest timestamp   Cassandra then sends the data to the client....

Workshop

  Apache Cassandra Workshop   1 ) Keyspaces:   a) Create Keyspace:   CREATE KEYSPACE MY_KEYSPACE WITH REPLICATION = {'class':'SimpleStrategy', 'replication_factor':'1'} AND durable_writes='true';  b) Describe Keyspace:     DESCRIBE KEYSPACES;   C)Use Keyspace: USE MY_KEYSPACE; 2)Create Table :   Here primary key is id CREATE TABLE employee_by_id(id int PRIMARY KEY, name text, position text); Here primary key is car_make and clustering id is ‘id’   CREATE TABLE employee_by_car_make(car_make text, id int,car_model text,   name text, PRIMARY KEY (car_make, id)); Here primary key are car_make & car_model CREATE TABLE employee_by_car_make_and_model(car_make text, car_model text, id int, name text, PRIMARY KEY((car_make, car_model), id)); 3) Describe Table:   DESCRIBE TABLE employee_by_car_make;   4)Insert INSERT INTO employee_by_id(id, name, position) VALUES (1, 'SUMITH', 'ARCHITECT'); INSERT INTO employee_by_car_make(car_m...