You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
blog/content/posts/Raft-Consensus-Algorithm.md

20 lines
466 B
Markdown

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

+++
title = "Raft共识协议的一些细节"
date = 2022-10-13
draft = true
[taxonomies]
tags=["Raft","分布式"]
+++
## Log compact机制
snapshot中需要对log进行compact防止log过多对服务造成大量压力。
### compact策略
* 执行snapshot时删除上次snapshot之前的数据
* 执行snapshot时固定保留最后n条entry
* leader计算近期分钟级别心跳中所有follower的next_index最小值再保留前n条entry