Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
支持 arbiter 副本,arbiter 不维护 FSM,没有用户数据,不能成为主,只能发起投票,必要时协助日志提交。
实现方式
分析
一致性:引入arbiter不会影响一致性。
可用性:引入arbiter会降低可用性。考虑以下场景: 3个节点,时刻A ,挂了一个非arbiter节点,此时 leader 通过arbiter提交一些日志。时刻B,旧的leader 挂了,并且挂掉的非arbiter节点恢复。恢复的节点无法成为主,因为缺失了一些日志,会被 arbiter 节点拒绝。这个是可以接受的,因为故障出现了交集,概率非常小。
对比其他实现
优点:
缺点:
总结:这个方案可以减少空间占用、提高qps,但会增加 latency,降低可用性。