Skip to content

Latest commit

 

History

History
95 lines (73 loc) · 2.54 KB

step2.md

File metadata and controls

95 lines (73 loc) · 2.54 KB
Replication ℹ️ For technical support, please contact us via email.
⬅️ Back Step 2 of 2 Next ➡️
Configure the nodes

✅ Start cqlsh

cqlsh

✅ Execute the following statements to create a keyspace with the NetworkTopologyStrategy that will store one replica per data center:

CREATE KEYSPACE killrvideo WITH replication = {
  'class': 'NetworkTopologyStrategy', 
  'dc-seattle': 1,'dc-atlanta': 1
};

✅ Switch to the killrvideo keyspace:

Solution
USE killrvideo;

✅ Execute the following commands to re-create the videos_by_tag table and re-import the data:

CREATE TABLE videos_by_tag (
    tag text,
    video_id uuid,
    added_date timestamp,
    title text,
    PRIMARY KEY ((tag), added_date, video_id))
    WITH CLUSTERING ORDER BY (added_date DESC, video_id ASC);

COPY videos_by_tag(tag, video_id, added_date, title)
FROM './data-files/videos-by-tag.csv'
WITH HEADER=TRUE;

✅ Exit cqlsh

QUIT

✅ Execute the following commands to determine which nodes the partition replicas reside on:

nodetool getendpoints killrvideo videos_by_tag 'cassandra'

nodetool getendpoints killrvideo videos_by_tag 'datastax'

You’ll be able to see the replicas nodes, represented by their IP addresses.

Datacenter dc-seattle contains 127.0.0.1 and 127.0.0.2. Datacenter dc-atlanta contains 127.0.0.3.

⬅️ Back Next ➡️