6.2 服务发现
为什么需要服务发现
在微服务架构中,服务实例动态增减,需要自动发现机制。
服务发现方案
客户端发现
- 客户端查询服务注册表
- 客户端选择实例并发起请求
优点:
- 直接通信,延迟低
缺点:
- 客户端复杂
服务端发现
- 客户端通过负载均衡器访问
- 负载均衡器查询服务注册表
优点:
- 客户端简单
缺点:
- 额外跳转
服务发现工具
- Consul
- Etcd
- Zookeeper
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help