1. 传统算法:quorum NRW, 2pc, 3pc等git
2. Paxos算法github
论文:《paxos made simple》, 《The Part-Time Parliament》算法
微信已经基于paxos开发了一套组件:sql
phxpaxos框架源码, 租约型paxos算法实现数据库
https://github.com/Tencent/phxpaxos微信
Phxsql: 基于phxpaxos框架开发的分布式sql数据库,框架
https://github.com/Tencent/phxsql分布式
Phxqueue: 基于phxpaxos框架开发的分布式消息队列性能
https://github.com/Tencent/phxqueuespa
Paxosstore,基于无租约型paxos算法实现的Nosql分布式数据存储系统,目前部分开源了算法的核心部分。
https://github.com/Tencent/paxosstore
paxos活锁问题:
多个paxos group同时prepare,容易出现活锁问题,既一段时间内任意一台机器都不能得到大多数机器的接受。解决方法是先肯定一个master,强一致选主,只有master能够prepare。
2. raft等算法
较paxos更加容易理解容易实现,强化leader地位,限制日志id连续性,可是也会必定程度上影响性能。
论文:《In Search of an Understandable Consensus Algorithm (Extended Version)》
较著名的实现有etcd, cockrouchDB,tidb, kubernetes。
etcd源码:
https://github.com/etcd-io/etcd
goraft源码:
https://github.com/goraft/raft