You should still be in cqlsh, if not start it again and connect to the cluster.
✅ Execute the following query to retrieve the tag partition key value for each row from the videos_by_tag table, along with its corresponding token:
SELECT tag, token(tag), title FROM videos_by_tag;
Question: How many unique tokens are in the table?
Answer
There are two unique tokens, one for each unique partition key.
✅ Exit from cqlsh:
exit
✅ Run the following command to refresh your memory as to which nodes own which token ranges.
/workspace/ds201-lab07/node1/bin/nodetool ring
✅ Execute the following commands to map the specific tags (datastax
and cassandra
) to endpoints/nodes.
Note: Note that we must also supply the keyspace and table name we are interested in since we set replication on a per-keyspace basis. There is more on replication to come later in this course.
/workspace/ds201-lab07/node1/bin/nodetool getendpoints killrvideo videos_by_tag 'datastax'
/workspace/ds201-lab07/node1/bin/nodetool getendpoints killrvideo videos_by_tag 'cassandra'
✅ Run nodetool status
again to see the token range ownership percentages.
/workspace/ds201-lab07/node1/bin/nodetool status
Question: What do the Owns values mean?
Answer
The Owns fields are the percentage of tokens owned by each node in the cluster. The tokens may not be evenly distributed because there are such a small number. The *videos* table as 5 unique tokens and the *videos_by_tag* table has 2.