✅ Start cqlsh from node3 since it is the only node running in dc-atlanta:
./node3/bin/cqlsh
✅ Switch to the killrvideo keyspace, set the consistency level to TWO
, and run the query again to retrieve the cassandra partition:
Solution
USE killrvideo;
CONSISTENCY TWO;
SELECT * FROM killrvideo.videos_by_tag WHERE tag = 'cassandra';
The query should error out with the message NoHostAvailable: because you cannot achieve a consistency level of 'TWO' with only one of the two replica nodes online.
✅ Set the consistency level back to ONE
and retry the query:
Solution
CONSISTENCY ONE;
SELECT * FROM killrvideo.videos_by_tag WHERE tag = 'cassandra';
The query should succeed because we still have one replica node available.
✅ Change the consistency level back to TWO
:
Solution
CONSISTENCY TWO;
✅ Run the following statement to insert a new row into the cassandra partition:
INSERT INTO videos_by_tag (tag, added_date, video_id, title)
VALUES ('cassandra', '2020-03-11', uuid(), 'I Love Cassandra');
The write should fail with the error NoHostAvailable: because we still cannot achieve a consistency level of TWO
.
✅ Change the consistency level back to ONE
and try the INSERT again:
Solution
CONSISTENCY ONE;
INSERT INTO videos_by_tag (tag, added_date, video_id, title)
VALUES ('cassandra', '2020-03-11', uuid(), 'I Love Cassandra');
✅ Quit cqlsh:
QUIT