nacos icon indicating copy to clipboard operation
nacos copied to clipboard

How to modify an instance enable to true when its enable state is false

Open Qutianyawangyue opened this issue 1 year ago • 1 comments

Nacos 2.1.0 Background: the service is deployed in k8s. When the pod is deleted, in order to prevent the pod from being deleted, but the springboot service still sends the heartbeat to re register, resulting in Nacos still marking the corresponding instance as available, we use to modify the enable status of the corresponding instance to false. However, when Nacos is unstable or the service is restarted, and the service is registered again after offline, the enable status is still false.

Question:

1: Is there a better integration mode of springboot+k8s+nacos recommended.

2: For offline services, the interface provided by OpenAPI cannot obtain instances. When Nacos exceptions recover, how do we use the interface to batch modify the offline status of instances and change them to online status 背景:服务部署在k8s中,当pod删除时,为了防止pod删除但springboot服务依旧发送心跳重新注册,导致nacos依旧标记对应实例为可用,我们采用的是修改对应实例的enable状态为false。但是当nacos不稳定,或服务重启时,服务下线后再次注册,enable的状态依旧为false。 问题: 1:是否有推荐的、更好的springboot+k8s+nacos的集成方式。 2:对于下线服务,openapi提供的接口无法获取实例,当nacos异常恢复后,我们需要如何去利用接口去批量修改实例下线状态,变更为上线状态

Qutianyawangyue avatar Aug 02 '22 05:08 Qutianyawangyue

https://nacos.io/zh-cn/docs/open-api.html

image

  1. 下线停止pod的时候调用接口下线了, 那上线的时候就应该调用接口上线,以此保持运维的原子性。
  2. openAPI是客户端使用的,想要获取全量内容需要控制台接口,不建议在程序里调用控制台接口,大量调用可能导致性能压力。

KomachiSion avatar Aug 04 '22 02:08 KomachiSion