Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Master-less model in Cassandra vs master-slave model in MongoDB?

I understand in Mongo we can have one master and multiple slaves where the master will be used for writes and slaves will be used for reading operations. Say M1, M2, M3 are nodes with M1 as master

But I read Cassandra is said to be a master-less model. Every node is said to be master. I did not get what it means?

Say M1, M2, M3 are nodes with M1 as master and M2, M3 are slaves in Mongo I believe write will always go M1 and read will always go to M2, M3

Say C1, C2, C3 are nodes in Cassandra Here I believe write and Read request can go to any node. That's why it is called master-less model.

like image 667
user3198603 Avatar asked Jan 25 '18 02:01

user3198603


1 Answers

You are right, the nodes in Cassandra are equal and all of them can respond to user's query. That's because Cassandra picks Availability and Partition Tolerance in the CAP Theorem (whereas MongoDB picks Consistency and Partition Tolerance). And Cassandra can have linear scalability by simply adding new nodes into the node ring to handle more data.

The tradeoff here is the consistency problem. In Cassandra, they provide a solution called Replication Factor and Consistency Level to ensure the consistency as much as possible while maintaining strong availability.

Here is a good explanation of how read, write and replication work in Cassandra: brief-introduction-apache-cassandra

like image 105
Ev3rlasting Avatar answered Sep 28 '22 04:09

Ev3rlasting