1000f8a80d
- Add gRPC service modules: auth, channel, channel settings, member, permission - Update protobuf definitions and generated code - Remove immediate/ real-time module (superseded by IM service) - Update etcd discovery and registration - Update cache, error, config, and build infrastructure - Add ADR documentation - Update OpenAPI spec
1.4 KiB
1.4 KiB
ADR-004: 使用 etcd 进行服务发现 / etcd for Service Discovery
状态 / Status
Accepted
日期 / Date: 2024-01-01
背景 / Context
平台依赖多个外部 gRPC 微服务(Git、Email),需要动态发现机制来连接这些服务。
The platform depends on multiple external gRPC microservices (Git, Email) and needs dynamic discovery to connect to them.
决策 / Decision
使用 etcd 进行服务发现和注册。
Use etcd for service discovery and registration.
考虑的方案 / Considered Options
- etcd — Kubernetes 生态标准,强一致性
- Consul — 功能丰富但较重
- ZooKeeper — 经典但运维复杂
- 静态配置 — 简单但不灵活
后果 / Consequences
正面 / Positive
- 与 Kubernetes 生态一致 / Aligned with Kubernetes ecosystem
- 强一致性保证 / Strong consistency guarantees
- 租约机制支持健康检查 / Lease mechanism supports health checks
- Watch 机制支持实时更新 / Watch mechanism supports real-time updates
负面 / Negative
- 额外的基础设施依赖 / Additional infrastructure dependency
- 运维复杂度增加 / Increased operational complexity
实现细节 / Implementation Details
- 注册:
register.rs— 自注册 + 租约保活 - 发现:
discovery.rs— Watch 动态连接 - 客户端: tonic/prost gRPC 客户端