Gossip

Like in real world we gossip same way cassandra nodes also do. Yes they really do but in different aspects 😉

Have you even thought how does a node communicates to another nodes.  How does a node have information that he is part of which cluster..how does it know to which node it needs to communicate ?

Gossip (Internode Communication) is peer-to-peer communication protocol through which nodes shares information about each other. The gossip process runs every second and exchanges state messages with up to three other nodes in the cluster. The nodes exchange information about themselves and about the other nodes that they have gossiped about, so all nodes quickly learn about all other nodes in the cluster. A gossip message has a version associated with it, so that during a gossip exchange, older information is overwritten with the most current state for a particular node.




if you see above picture then in this cluster we have 5 nodes, 2 nodes(node1,node2) in datacenter1 and 3 nodes (node3,node4,node5) in datacenter2. 

 To avoid gossip communication problem you should mention same seed node in a cluster as a best practice. If you see in above picture that each nodes communicates with node2 and node3 where as node2 in DC1 and node3 in DC2. You should node make all node as seed node because it will impact gossip performance.  In multiple data-center clusters, the seed list should include at least one node from each datacenter (replication group).

How does a node know to which node to gossip ?

you need to set value for Seed in  cassandra.yaml configuration file.

seed_provider:
# Addresses of hosts that are deemed contact points.
# Cassandra nodes use this list of hosts to find each other and learn
# the topology of the ring. You must change this if you are running
# multiple nodes!
- class_name: org.apache.cassandra.locator.SimpleSeedProvider
parameters:
# seeds is actually a comma-delimited list of addresses.
# Ex: ",,"
- seeds: "node2,node3"




 



 

1 comment: