赞
踩
Eureka强制下线
强制下线
可以通过调用stateUpdate接口,更改实例的状态为OUT_OF_SERVICE 。
实现方式
调用接口:/eureka/apps/appID/instanceID/status?value=OUT_OF_SERVICE
调用示例:http://101.37.33.252:8083/eureka/apps/EUREKA-1/10.28.144.127:17101/status?value=OUT_OF_SERVICE
调用方式:PUT
具体表现
当调用上面的接口之后,实例的状态即被修改为OUT_OF_SERVICE
当调用EUREKA-1的客户端刷新本地缓存之后,获取到EUREKA-1的最新状态,在调用过程中,就会发生错误,表示服务不可用
{
"timestamp": 1528353497748,
"status": 500,
"error": "Internal Server Error",
"exception": "java.lang.RuntimeException",
"message": "com.netflix.client.ClientException: Load balancer does not have available serverfor client: eureka - 1 ",
"path ":" /a/get "}
"timestamp": 1528353497748,
"status": 500,
"error": "Internal Server Error",
"exception": "java.lang.RuntimeException",
"message": "com.netflix.client.ClientException: Load balancer does not have available serverfor client: eureka - 1 ",
"path ":" /a/get "}
手动上线
删除实例的覆盖状态,同时修改实例的状态为UP , 当客户端的缓存刷新之后,获取到EUREKA-1的状态为UP,那么服务就立马OK了
实现方式
请求接口:/eureka/apps/appID/instanceID/status?value=UP
调用示例:http://101.37.33.252:8083/eureka/apps/EUREKA-1/10.28.144.127:17101/status?value=UP
调用方式:DELETE
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。