Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

berj275 avatar image
berj275 asked Erick Ramirez edited

Is it possible to replicate keyspaces to different data centers?

I have a general question about replicating keyspaces in DSE. Here's the scenario.

In data center #1 (US based) I have two keyspaces, KS1 and KS2. I'd like to replicate KS1 to data center 2 (EU based DC) and replicate KS2 to data center 3 (MEISA based DC). Is that possible to do? Please note that KS1 and KS2 are both located on the same ring in DC #1.

Any information you can provide is greatly appreciated.

replication
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

steve.lacerda avatar image
steve.lacerda answered berj275 commented

Hi, I think I understand your question and yes, that's absolutely possible. You're schema keyspace definition would look like the following:

CREATE KEYSPACE KS1 WITH replication={'class': 'NetworkTopologyStrategy', 'dc1': 3, 'dc2': 3};

CREATE KEYSPACE KS2 WITH replication={'class': 'NetworkTopologyStrategy', 'dc1': 3, 'dc3': 3};

Let me know if I'm off base, but I think that's the scenario you're describing.

1 comment Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Thanks for the great answers! DSE is still new to me and I'm learning all the details as I go.

1 Like 1 ·
starlord avatar image
starlord answered starlord commented

Hi berj275,

Assuming the DCs are all in the same cluster, yes, you can replicate a keyspace to any DC you like with any Replication Factor less than the number of nodes in the DC, although an RF of 3 works best for most.

You'll just want to ensure you use the NetworkTopologyStrategy for replicating across DCs, for example:

ALTER KEYSPACE <keyspaceName> WITH REPLICATION = {'class' : 'NetworkTopologyStrategy', 'DC1' : 3, 'DC2' : 2 };

Use the appropriate DC names as well, but include only the ones you want to replicate to.

Let us know if there are any other questions.

1 comment Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Sorry, posted the same time as steve.lacerda, you get two examples :)

0 Likes 0 ·