Centralized configuration
Contents
what: 轻量级的数据库,存储非业务相关数据,基于数据库,git实现
store data example:
- db url, password
- jwt token
为什么需要:
- 实时更新
- 统一管理: 特别是在微服务场景
- 高级功能
core function:
-
实时更新: monitor
-
多环境配置
-
权限控制
-
版本管理:
- version history
- 回滚
- 灰度发布
-
web管理后台
the types:
- custom
- nacos
- apolo
custom:
|
|
list
spring cloud config
Disconf
apollo
nacos
space:
- namespace: a set of group
- group: a group of config
- dataid: a detail config
pros:
- easy cons:
- 更新粒度太大,无法做到增量更新
- 权限控制太粗糙
polling
poll: 反复的检查是否有数据/准备就绪
http poll:
- short poll: 服务端立即返回结果
- long poll: 服务端阻塞客户端直到有结果才返回
http long poll code:
|
|
nacos config
-
configure auth:
-
NACOS_AUTH_ENABLE