2
votes

I have a Cassandra DB and a keyspace with some Tables which i do not want to repplicate. I know, a key feature of cassandra is the replication, but i do not want to replicate.

I have 3 DataCenters: dc1, dc2, dc3

currently i'am creating the Keyspace like this on each DC:

CREATE KEYSPACE IF NOT EXISTS myKeyspace 
  WITH replication={'class':'NetworkTopologyStrategy', 'dc1': '1'};

As i understood this means dc1 will be replicated to one of the three other DCs? How should this look like if i do not want to replicate?

1

1 Answers

4
votes
CREATE KEYSPACE IF NOT EXISTS myKeyspace WITH replication={'class':'NetworkTopologyStrategy', 'dc1': '1'};

This means that you have replication factor 1 on dc1. So what have you have currently is what you want. Replication factor of 1 will mean only one node will hold the data and it won't be replicated anywhere else. The number is not for how many copies but for the number of nodes that hold the data.

If you wanted it replicated to other dcs it would be something like this:

CREATE KEYSPACE IF NOT EXISTS myKeyspace WITH replication={'class':'NetworkTopologyStrategy', 'dc1': '1', 'dc2': '1', 'dc3': '3'};

Meaning dc1 will have data on 1 node, dc2 will have data on 1 node and dc1 will have the data on 3 nodes