consul 官方文档中注册的服务有个维护模式,具体的应用场景是什么样的呢?
官方解释(有道翻译)-原文
This endpoint places a given service into "maintenance mode". During maintenance mode, the service will be marked as unavailable and will not be present in DNS or API queries. This API call is idempotent. Maintenance mode is persistent and will be automatically restored on agent restart.
翻译:
该端点将给定的服务置于“维护模式”。在维护模式中,该服务将被标记为不可用, 并且不会出现在DNS或API查询中。这个API调用是幂等的。维护模式是持久的, 将在代理重新启动时自动恢复。
我的理解(不知道我的理解对不对)
- 就是服务注册完,如果服务需要重启的时候,可以先让服务处于:维护模式,重启完成后,再关闭维护模式,这样就可以防止在服务重启的时候,会有请求转发过来,导致报错