<aside> 💡 分布式系统:通常由异步网络连接的多个节点构成,每个节点有独立的计算和存储,节点之间通过网络通信进行协作

</aside>

共识 Consensus

<aside> 💡 分布式系统中多个节点之间,彼此对某个状态达成一致结果的过程

</aside>

虽然共识 (Consensus) 和一致性 (Consistency) 在很多应用场景中被认为是近似等价的, 但二者涵义存在着细微的差别:

由于翻译的关系,很多中文资料把 Consensus 翻译为一致性,导致概念混淆。所以,分布式一致性算法的说法是错误的,正确的名称应该是分布式共识算法。

共识达成条件

<aside> 💡 诚实节点是符合我们期望的节点行为的节点,与之相反的是恶意节点

</aside>

一致性 Consistency

<aside> 💡 一致性要求的是一致,并不是正确,如果所有节点一致给出一个”错误“的答案,那也叫一致性

</aside>

Strong consistency
– ensures that only consistent state can be seen.

* All replicas return the same value when queried for the attribute of an object * All replicas return the same value when queried for the attribute of an object. This may be achieved at a cost – high latency.

Weak consistency
 – for when the “fast access” requirement dominates.

* update some replica, e.g. the closest or some designated replica
* the updated replica sends up date messages to all other replicas.
* different replicas can return different values for the queried attribute of the object the value should be returned, or “not known”, with a timestamp
* in the long term all updates must propagate to all replicas …….

--- [Consistency in Distributed Systems](<https://www.cl.cam.ac.uk/teaching/0910/ConcDistS/11a-cons-tx.pdf>)

线性一致性

<aside> 💡 对于任何一个数据对象来说,系统表现得就像它只有一个副本一样

</aside>