如何使第2阶段中的Paxos感分布式共识算法? [英] How to make sense of Phase 2 in Paxos distributed consensus algorithm?

查看:135
本文介绍了如何使第2阶段中的Paxos感分布式共识算法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经贴伪$ C $下一个Paxos的算法在这里:

I have pasted pseudocode for a paxos algorithm here:

<一个href="http://stackoverflow.com/questions/10490902/what-is-a-view-in-the-paxos-consensus-algorithm">What是&QUOT;查看&QUOT;在协商一致的Paxos算法?

和想知道,如果有人可以点我在正确的方向。

and was wondering if someone could point me in the right direction.

该算法说每个节点都有一个状态,其中包含了一堆信息的节点应该防不胜防。

The algorithm says that each node has a "state" which contains a bunch of information the node should keep track of.

假设我们有两个节点:节点#1和节点#2。在最简单的情况下,节点#2加入节点#1,他们都发挥的Paxos。到底发生了什么的节点#1和节点#2后2加入1的状态?什么时候该意见的数据结构的变化和它包含什么?如果有人能够给我解释一下两个节点的Paxos玩这个简单的情况下,那么我想我可以找出多个节点的情况下。

Suppose we have two nodes: Node #1 and Node #2. In the simplest case Node #2 joins Node #1 and they both play paxos. What exactly happens to the states of Node #1 and Node #2 after 2 joins 1? When does the "views" data structure change and what does it contain? If someone can explain to me this simple case of two nodes playing paxos, then I think I can figure out multiple node case.

我目前的理解(我敢pretty的肯定是不正确的)如下:

My current understanding (which I'm pretty sure is not correct) is as follows:

  1. 在节点#2将消息发送到加入节点#1。
  2. 在节点#1接收消息的节点#2要求加入。
  3. 在节点#1假定领导和踢成1阶段,计算my_num = MAX(0,0)+ 1 = 1
  4. 在节点#1发送的所有节点的观点[0](即空)prepare(1,1)
  5. 在节点#1发送初始接触点(节点#2)prepare(1,1)
  6. 在节点#1发送节点#1(本身)prepare(1,1)
  7. 在节点#2接收prepare(1,1)。它规定了num_h = 1,并返回到领导者PROMISE(0,{空单})
  8. 在节点#1接收prepare(1,1),并将其num_h = 1,然后返回自己PROMISE(0,{空单})。

现在我们得到逐步2

这是我很困惑。

节点#1是领导者,它接收两个PROMISE(0,{空单})的消息。根据该算法,如果领导者得到了多数承诺在次[0]那么它可以设定为v的一个值,并发送ACCEPT消息给所有的应答者。

Node #1 is the leader and it receives two PROMISE(0,{empty list}) messages. According to the algorithm, if the leader gets a majority of promises in views[0] then it can set a value for "v" and send the ACCEPT message to all responders.

目前我感到困惑的是意见[0]领导者是空的,所以你怎么能计算出大部分的空列表?

What I am confused about is currently the views[0] for the leader is empty so how can you compute the majority of an empty list?

另外,我们假设的领导者已经获得了大部分的承诺和收益如何设置v =设置ping到节点(包括个体经营)。究竟是什么ping的节点?难道仅仅节点#1和节点#2?

Also, let's assume the leader has received a majority of promises and proceeds to set v = set of pingable nodes (including self). What exactly are pingable nodes? Is it just Node #1 and Node #2?

请问AP preciate所有/任何帮助,肯定会奖励分给那些帮助。

Would appreciate all / any help and will definitely award points to those that help.

推荐答案

伪code不是专门针对一个特定的问题。事实上,这位教授说,我们并不需要使用伪code,如果我们不想说我们可以看看其他的Paxos论文(即Paxos的制作简单,制成的Paxos现场等)进行指导在实现这个算法。也许你是对的,我也许应该看看维基百科来实现这个算法。因此,意见[..]是一个简单的散列图和节点可以选择其希望的任意值。如果我理解正确的话,你说的大部分语句只检查是否获得足够的承诺信息。但只有这样,才能知道我们是否有足够的是,如果节点跟踪谁是它的组成员。这意味着,我需要一个不同的数据结构这一点。

The pseudocode is not specialized for a particular problem. In fact, the professor said we don't need to use pseudocode if we don't want to and said we can look at other Paxos papers (i.e. paxos made simple, paxos made live,etc..) for guidance on implementing this algorithm. Maybe you are right, I should probably look at Wikipedia to implement this algorithm. So the views[..] is simply a hash map of and a node can choose any value it wishes to. If I understand you correctly, you say the majority statement just checks if it received "enough" PROMISE messages. But the only way to know if we have enough is if the node keeps track of who its group members are. Which means that I need a different data structure for this.

另外,我不奖励积分给你,因为你做了评论。如果您发布一个答案,然后我可以给你点。

Also, I cannot award points to you because you made a comment. If you post an answer then I can give you points.

这篇关于如何使第2阶段中的Paxos感分布式共识算法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆