注册中心 Eureka 客户端无损下线相关配置
Eureka 服务注册发现流程
Eureka 配置修改
Eureka client (consumer)
1 | # Indicates whether this client should fetch eureka registry information from eureka server. |
Eureka client (provider)
1 | # Map of availability zone to list of fully qualified URLs to communicate with eureka server. Each value can be a single URL or a comma separated list of alternative locations. Typically the eureka server URLs carry protocol,host,port,context and version information if any. Example: http://ec2-256-156-243-129.compute-1.amazonaws.com:7001/eureka/ The changes are effective at runtime at the next service url refresh cycle as specified by eurekaServiceUrlPollIntervalSeconds. |
Eureka server
1 | # Indicates the time in seconds that the eureka server waits since it received the last heartbeat before it can remove this instance from its view and there by disallowing traffic to this instance. Setting this value too long could mean that the traffic could be routed to the instance even though the instance is not alive. Setting this value too small could mean, the instance may be taken out of traffic because of temporary network glitches.This value to be set to atleast higher than the value specified in leaseRenewalIntervalInSeconds. |
Eureka 配置验证
配置修改后,可以请求端点:/actuator/configprops,验证配置,例如:
Eureka server
查找关键字:responseCacheUpdateIntervalMs:
Eureka client
Eureka client (Consumer) 查询关键字:registryFetchIntervalSeconds
Eureka client (Consumer) 可以请求端点:/actuator/health 验证服务下线的感知结果:
Eureka client 接口上下线
Eureka client 服务下线接口:/actuator/service-registry?status=DOWN
1 | curl --location --request POST 'http://127.0.0.1:58061/actuator/service-registry?status=DOWN' \ |
Eureka client 服务上线接口:/actuator/service-registry?status=UP
1 | curl --location --request POST 'http://127.0.0.1:58061/actuator/service-registry?status=UP' \ |
Eureka server 验证结果:
1 | curl --location --request GET 'http://192.168.33.42:8000/eureka/apps' \ |