Skip to content
Related Articles

Related Articles

Gossip Protocol in Cassandra

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 28 Apr, 2022

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-sync. 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-sync ? 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.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!