关于influxdb:InfluxDB集群-antientropy概念解析

3次阅读

共计 966 个字符,预计需要花费 3 分钟才能阅读完成。

influxdb 的 data 节点是 AP 一致性,可用性优先,然而数据要最终统一。

anti-entropy 意为“反熵”,熵简略的了解成 shard 间的不统一;anit-entropy 运行在 data 节点上,通过比照 shard 间的不统一,进行 shard 数据修复,实现数据的最终统一。

anti-entropy 的配置

anti-entropy 默认是敞开的:

### [anti-entropy]
### Anti Entropy is used to check missing shards on data node.
### If missing shards are found it will copy the shards from other replications.
### Please don't enable anit-entropy if replication is 1.
###

[anti-entropy]
  enabled = false
  # check-interval = "30s" # The anti entropy service will check the missing shards very check-interval seconds.

当被开启时,node 上失落的分片会被主动修复,而内容不统一的分片须要手动 (命令行) 确认修复。

shard 修复策略

失落的分片:

  • goroutine 定期检查 node 上短少的分片(元数据中有,然而本地没有 shard 文件);
  • 对短少的每个分片,启动 1 个 goroutine 从 peer 节点 copy 这个分片;

内容不统一的分片:分片熵的检测和修复流程如下

典型利用场景

Data 节点因为磁盘故障等起因不可用,则只需将新的 data 节点退出集群,新节点上的 anti-entropy 会主动从其它节点 copy 分片。

因为硬件降级等起因,替换正在运行的 data 节点,新节点上的 anti-entropy 会主动从其它节点 copy 分片。

anti-entropy 与 hinted-handoff

anti-entropy 和 hinted-handoff 都用来保障 data 节点 AP 一致性,最终达到数据的最终统一。

  • hh 不能解决节点更换的场景;

    • hh 解决的是远端节点临时无响应时,先在本机缓存下来,待远端节点复原时,再将数据发往远端节点;
  • anti-entropy 能够主动修复整个分片短少的场景,当产生分片内容不统一时,须要手动命令行修复。
正文完
 0