简体   繁体   中英

2 and 3 node Cassandra cluster setup

I have 2 issues.

1- I need 2 node cluster. I must write & read if 1 node is gone.
I think I need= Replication Factor:2 Consistency:1
But it certainly should not be the loss of any data.

2- I need 3 node cluster and nodes may increase over time. I should be able to add more nodes with this setup.
I think I need= Replication Factor:3 Consistency:2

The question is: Am i right on this configurations?

Thank you for answers.

tldr; Use 3 node cluster for both, write/read quorum.

Keep in mind: Write Consistency + Read Consistency > Replication factor to ensure that your data is consistent.

You may as well go with a 3 node cluster for both. Alternatively in your first setup (2 nodes) is the same as a 1 node 'cluster'. Because you're either writing to ALL, or your reads won't be consistent.

Setup 1:

For Setup 1 in a RF 2 you would need to:

  • Write(2) + Read(1) If a node goes down, you can no longer write to the cluster.
  • Read(2) + write(1) If a node goes down you can no longer read from the cluster AND you've lost data.
  • Write(2) + Read(2) Same effort as 3 node cluster. Why do 2?

Neither of these is ideal and the only advantage the 2 node cluster has over a 1 node 'cluster' is that if you're writing to all at least you don't lose data when a node dies.

Setup 2:

Ideally here you go with quorum, otherwise you're more likely to suffer outages.

  • Write(2) + Read(2) > RF Quorum (option 1) enables 1 node to die and your cluster to function as normal.
  • Write(3) + Read(1) > RF Write 3 allows you to only read from 1 node, speeding up reads at the cost of failing writes if a node becomes disconnected.
  • Write(1) + Read(3) > RF Read 3 Speeds up writes at the cost of losing data if a node goes down.
  1. You should keep in mind that each of your servers will hold 100% of your data. So in terms of speed you probably won't gain too much. Otherwise, having a CL of 1 for both read and writes won't lead to data loss. Also, don't forget about the hints, if 1 node is down and bring it up.

  2. For this one you could use also QUORUM. This one implies that half of the replicas plus 1 should respond to the operation.

Also, I would suggest some reading Configuring data consistency and Replication, High Availability and Consistency in Cassandra

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM