Cassandra rack concept and database structure
Asked Answered
R

1

9

I am new to Cassandra and I would like to learn more about Cassandra's racks and structure.

Suppose I have around 70 column families in Cassandra and two AWS2 instances.

  1. How many Data Centres will be used?
  2. How many nodes will each rack have?
  3. Is it possible to divide a column family in multiple keyspaces?
Risible answered 10/3, 2014 at 7:40 Comment(1)
Please ask only one question per post. Edit your post so it asks onky ine question, and put the other question in a new post.Oppugn
F
10

The intent of making Cassandra aware of logical racks and data centers is to provide additional levels of fault tolerance. The idea (as described in this document, under the "Network Topology Strategy") is that the application should still be able to function if one rack or data center goes dark. Essentially, Cassandra...

places replicas in the same data center by walking the ring clockwise until reaching the first node in another rack. NetworkTopologyStrategy attempts to place replicas on distinct racks because nodes in the same rack (or similar physical grouping) often fail at the same time due to power, cooling, or network issues.

In this way, you can also query your data by LOCAL_QUORUM, in which QUORUM ((replication_factor / 2) + 1) is only computed from the nodes present in the same data center as the coordinator node. This reduces the effects of inter-data center latency.

As for your questions:

  1. How many data centers are used are entirely up to you. If you only have two AWS instances, putting them in different logical data centers is possible, but only makes sense if you are planning to use consistency level ONE. As-in, if one instance goes down, your application only needs to worry about finding one other replica. But even then, the snitch can only find data on one instance, or the other.

  2. Again, you can define the number of nodes that you wish to have for each rack. But as I indicated with #1, if you only have two instances, there isn't much to be gained by splitting them into different data centers or racks.

  3. I do not believe it is possible to divide a column family over multiple keyspaces. But I think I know what you're getting at. Each keyspace will be created on each instance. As you have 2 instances, you will be able to specify a replication factor of 1 or 2. If you had 3 instances, you could set a replication factor of 2, and then if you lost 1 instance you would still have access to all the data. As you only have 2 instances, you need to be able to handle one going dark, so you will want to make sure both instances have a copy of every row (replication factor of 2).

Really, the logical datacenter/rack structure becomes more-useful as the number of nodes in your cluster increases. With only two, there is little to be gained by splitting them with additional logical barriers. For more information, read through the two docs I linked above:

Apache Cassandra 2.0: Data Replication

Apache Cassandra 2.0: Snitches

Forepleasure answered 10/3, 2014 at 14:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.