In this article, we’ll be looking briefly at the Gossip protocol that is implemented in the Apache Cassandra database. In this article, we will discuss Gossip protocol and How Cassandra achieves coordination between nodes and How nodes stay in-synch.
In Cassandra, all nodes are the same and have peer to peer architecture and there is no concept of a master-slave node. In Cassandra all nodes communicating with each other via a gossip protocol. Gossip is the message system that Cassandra node use to make their data consistent with each other.
What is Gossip protocol ?
Gossip is the message system that Cassandra nodes, virtual nodes used to make their data consistent with each other, and is used to enforce the replication factor in a cluster. So, let’s imagine and Cassandra cluster as a ring system where each node contains a certain partition of each table in the database. And, can only communicate with adjacent nodes.
How Cassandra achieve coordination between nodes ?
Let’s consider an example with 6 nodes in a cluster. one and two three four five and six, and you can see that node number three is down. So, there is a question, how Cassandra will behave in such situations. So, Gossip is a peer-to-peer communication protocol in which nodes periodically exchange state information about themselves and about other nodes they know about.
The Gossip protocol runs every second and exchange state messages with up to three other nodes in the cluster.
In Cassandra, Gossip protocol is very useful because nodes exchange information about themselves and about the other nodes that they have gossiped about, so all nodes quickly learn about other nodes in the cluster.
How nodes stay in-synch ?
This is how Gossip protocol works if any node goes down. Let’s discuss with Gossip protocol definition. Gossip message has a version associated with it, so that during a Gossip exchange, other information is overwritten with the most current state for a particular node.
We can split when that we have a quorum of four nodes and two nodes are not to trouble. When the network heals and we have an again cluster of six nodes, so everything is connected. Then, we need to do something with the state that is a style in those two nodes. So, we need to merge those new states in a cluster of quorum with other nodes. And, then Gossip protocol will choose that newest state, so there is a possibility of losing state.
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Features of Cassandra
- Snitches in Cassandra
- Useful CQL query in Cassandra
- Updating Set in Cassandra
- Difference between Cassandra and IBM Db2
- Securing Cassandra
- Bulk Reading in Cassandra
- Expand on command in Cassandra
- Replication strategy in Cassandra
- Counter Type in Cassandra
- Difference between SQLite and Cassandra
- Introduction to Apache Cassandra
- Operations on table in Cassandra
- Designing models in Cassandra
- Modifying keyspace in Cassandra
- Static type in Cassandra
- Data Distribution in Cassandra
- Lightweight Transactions in Cassandra
- Aggregate functions in Cassandra
- Architecture of Apache Cassandra
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.