欢迎投稿

今日深度:

About Internode Communications (Gossip) cassandra(流言协议),internodegossip

About Internode Communications (Gossip) cassandra(流言协议),internodegossip


  Cassandra uses a protocol called gossip to discover location and state information about the other nodes participating in a Cassandra cluster. Gossip is a peer-to-peer communication protocol in which nodes periodically exchange state information about themselves and about other nodes they know about.

  因为cassadra的目标是运行在多个数据中心的多个机器上,它的所有设计,都以此为起点,好多节点组成一个集群来共同向外提供服务。这机器多了,和人多了是一个道理,都得要交流一下,cassandra节点和节点之间的交流,就靠的是一个叫 gossip的协议。gossip是流言的意思,爱看美剧的同胞,估计都看过一个叫 gossip girl(绯闻女孩)的连续剧,讲的是上流社会的故事,在这里, gossip依然很‘上流’,它是专门为分布式计算设计的一个东西,它来源于现实生活中的流言传播。

 

  流言传播和现在的微博营销都是一个爹妈生养的,只是一个负面,一个正面而已,目的都是广而告之,把信息散播出去。gossip就是在计算机领域里,把信息传播都集群里的每个节点上,说到广而告之,多数人首先想到的是拿一个大喇叭吼上一通,在分布式计算领域,大喇叭的方式就比较粗糙了,得有更精细化的方式,gossip就是其中一个,它是一个p2p的协议,对于cassadra而言,就是集群里的每个节点,周期性的散播谣言,怎么个散播法呢?就是交换下你知道的信息和我知道的信息,(比如说,坐下自我介绍,再问问,你叫什么呀,你喜欢周杰乱吗,你知道王石头最新的小情人不?)。节点和节点之前,聊完天,侃大山完毕,就能知道自己和别人的位置(location)和状态(state)了。

 


  In Cassandra, 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.

 

  刚才说周期性地聊儿天,要多少周期呢? 在cassandra里,是一秒,隔一秒就聊十块钱儿的,聊的对象都是关于集群里的另外三个节点的八卦事,为啥是三个节点呢?人多了也记不住不是。

 

  大家不要小看这个聊天,聊这一下子,信息散播的可快了,100来人的规模,一个谣言很速度就能传播完毕,正是好事不出门,坏事传千里,刷刷的,信息就覆盖整个集群了(all nodes quickly learn about all other nodes)。

 

  这聊的信息,也有新有旧,比如说刘德华要结婚了,这个消息已经很老了,都快过半个世纪了,你再说这事,就没人理你了,更新的消息是,人家孩子都上学了,大家都关注的是新消息(older information is overwritten with the most current state)

www.htsjk.Com true http://www.htsjk.com/cassandra/34253.html NewsArticle About Internode Communications (Gossip) cassandra(流言协议),internodegossip   Cassandra uses a protocol called gossip to discover location and state information about the other nodes participating in a Cassandra cluster. Gossip is a...
相关文章
    暂无相关文章
评论暂时关闭