目录

etcd

强一致性的分布式键值存储数据库

功能:管理配置信息和服务发现

特点

  1. 简单:具有定义良好、面向用户的 API (gRPC)
  2. 安全:支持 HTTPS 方式的访问
  3. 快速:支持并发 10 k/s 的写操作
  4. 可靠:支持分布式结构,基于 Raft 的一致性算法

  5. http(s)传输,简单
  6. 键值存储(类似文件目录层次)
  7. 变化检测(可监测键或目录变化)

etcd 的使用其实非常简单,它对外提供了 gRPC 接口,我们可以通过 Protobuf 和 gRPC 直接对 etcd 中存储的数据进行管理,也可以使用官方提供的 etcdctl 操作存储的数据。

用途

  1. A simple use case is storing database connection details or feature flags in etcd as key-value pairs. These values can be watched, allowing your app to reconfigure itself when they change.
  2. Advanced uses take advantage of etcd’s consistency guarantees to implement database leader elections or perform distributed locking across a cluster of workers.

用于kubernetes(存储相关信息,一般是配置等小数据信息):etcd is the backend for service discovery and stores cluster state and configuration

共识算法 Raft

在一个分布式系统中,如何保证集群中所有节点中的数据完全相同并且能够对某个提案(Proposal)达成一致是分布式系统正常工作的核心问题,而共识算法就是用来保证分布式系统一致性的方法。

其他

服务器时延

Latency from the etcd leader is the most important metric to track. severe latency will introduce instability within the cluster because Raft is only as fast as the slowest machine in the majority.

参考链接:https://draveness.me/etcd-introduction/