Cassandra LOCAL_QUORUM

JDesuv picture JDesuv · Jul 28, 2015 · Viewed 13.1k times · Source

I'm having trouble understanding / finding information about how various quorums are calculated in cassandra.

Let's say I have a 16 node cluster using Network Topology Strategy across 2 data centers. The replication factor is 2 in each datacenter (DC1: 2, DC2: 2).

In this example, if I write using a LOCAL_QUORUM, I will write the data to 4 nodes (2 in each data center) but when will the acknowledgement happen? After 2 nodes in 1 data center are written?

In addition, to maintain strong read consistency, I need Write nodes + read nodes > replication factor. In the above example, if both reads and writes were LOCAL_QUORUM, I would have 2 + 2 which would not guarantee strong read consistency. Am I understanding this correctly? What level would I need then to ensure strong read consistency?

The goal here is to ensure that if a data center fails, reads/writes can continue while minimizing latency.

Answer

Stefan Podkowinski picture Stefan Podkowinski · Jul 28, 2015

The write will be successful after the coordinator received acknowledgement from 2 nodes from the same DC of the coordinator.

Using LOCAL_QUORUM for both reads and write will get you strong consistency, provided the same DC will be used for both reads and write, and just for this DC.