微服务Spring Cloud Eureka 客户端-实例配置(eureka.instance.xxx)

提取自 spring-cloud-netflix-eureka-client-1.4.4.RELEASE.jar!/META-INF/spring-configuration-metadata.json
Bean类:org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean
参考配置说明:https://github.com/Netflix/eureka/blob/master/eureka-client/src/main/java/com/netflix/appinfo/EurekaInstanceConfig.java

常见配置

name(eureka.instance.xxx开头配置) defaultValue description
instance-id   Get the unique Id (within the scope of the appName) of this instance to be registered with eureka.
此实例注册到eureka服务端的唯一的实例ID,其组成为${spring.application.name}:${spring.application.instance_id:${random.value}}
appname unknown Get the name of the application to be registered with eureka.
服务名,默认取 spring.application.name 配置值
hostname   The hostname if it can be determined at configuration time (otherwise it will be guessed from OS primitives).
主机名,不配置的时候讲根据操作系统的主机名来获取
prefer-ip-address false Flag to say that, when guessing a hostname, the IP address of the server should be used in prference to the hostname reported by the OS.
是否优先使用IP地址作为主机名的标识
如果设置了tru,则使用该属性配置的IP,否则自动获取除环路IP外的第一个IP地址
ip-address   Get the IPAdress of the instance. This information is for academic purposes only as the communication from other instances primarily happen using the information supplied in {@link #getHostName(boolean)}.
IP地址
lease-expiration-duration-in-seconds 90 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 client发送心跳给server端的频率。如果在leaseExpirationDurationInSeconds后,server端没有收到client的心跳,则将摘除该instance。除此之外,如果该instance实现了HealthCheckCallback,并决定让自己unavailable的话,则该instance也不会接收到流量。
lease-renewal-interval-in-seconds 30 Indicates how often (in seconds) the eureka client needs to send heartbeats to eureka server to indicate that it is still alive. If the heartbeats are not received for the period specified in leaseExpirationDurationInSeconds, eureka server will remove the instance from its view, there by disallowing traffic to this instance. Note that the instance could still not take traffic if it implements HealthCheckCallback and then decides to make itself unavailable.
定义服务失效的时间,单位:秒
表示eureka server至上一次收到client的心跳之后,等待下一次心跳的超时时间,在这个时间内若没收到下一次心跳,则将移除该instance。
该值至少应该大于leaseRenewalIntervalInSeconds
home-page-url   Gets the absolute home page URL for this instance. The users can provide the homePageUrlPath if the home page resides in the same instance talking to eureka, else in the cases where the instance is a proxy for some other server, users can provide the full URL. If the full URL is provided it takes precedence. It is normally used for informational purposes for other services to use it as a landing page. The full URL should follow the format http://
获取此实例的绝对主页URL路径,为其他服务提供信息时使用的路径,默认为null
home-page-url-path / Gets the relative home page URL Path for this instance. The home page URL is then constructed out of the hostName and the type of communication - secure or unsecure. It is normally used for informational purposes for other services to use it as a landing page.
获取此实例的相关主页URL路径,然后构造出主机名,安全端口等,默认为/
health-check-url   Gets the absolute health check page URL for this instance. The users can provide the healthCheckUrlPath if the health check page resides in the same instance talking to eureka, else in the cases where the instance is a proxy for some other server, users can provide the full URL. If the full URL is provided it takes precedence. <p> It is normally used for making educated decisions based on the health of the instance - for example, it can be used to determine whether to proceed deployments to an entire farm or stop the deployments without causing further damage. The full URL should follow the format http://
配置健康检查页面的URL,绝对路径
health-check-url-path /health Gets the relative health check URL path for this instance. The health check page URL is then constructed out of the hostname and the type of communication - secure or unsecure as specified in securePort and nonSecurePort. It is normally used for making educated decisions based on the health of the instance - for example, it can be used to determine whether to proceed deployments to an entire farm or stop the deployments without causing further damage.
健康检查页面的URL,相对路径,默认使用 HTTP 访问,如果需要使用 HTTPS则需要使用绝对路径
secure-health-check-url   Gets the absolute secure health check page URL for this instance. The users can provide the secureHealthCheckUrl if the health check page resides in the same instance talking to eureka, else in the cases where the instance is a proxy for some other server, users can provide the full URL. If the full URL is provided it takes precedence. <p> It is normally used for making educated decisions based on the health of the instance - for example, it can be used to determine whether to proceed deployments to an entire farm or stop the deployments without causing further damage. The full URL should follow the format http://
获取此实例的绝对安全健康检查网页的URL路径,默认为null

其他配置

name(eureka.instance.xxx开头配置) defaultValue description
a-s-g-name   Gets the AWS autoscaling group name associated with this instance. This information is specifically used in an AWS environment to automatically put an instance out of service after the instance is launched and it has been disabled for traffic..
与此实例相关联 AWS自动缩放组名称。此项配置是在AWS环境专门使用的实例启动,它已被用于流量停用后自动把一个实例退出服务。
app-group-name   Get the name of the application group to be registered with eureka.
data-center-info   Returns the data center this instance is deployed. This information is used to get some AWS specific instance information if the instance is deployed in AWS.
该实例被部署在数据中心
default-address-resolution-order   获取实例的网络地址,默认为[]
environment    
initial-status   Initial status to register with rmeote Eureka server.
instance-enabled-onit false Indicates whether the instance should be enabled for taking traffic as soon as it is registered with eureka. Sometimes the application might need to do some pre-processing before it is ready to take traffic.
实例注册到eureka服务器时,是否开启通讯,默认为false
metadata-map   Gets the metadata name/value pairs associated with this instance. This information is sent to eureka server and can be used by other instances.
获取与此实例相关联的元数据(key,value)。这个信息被发送到eureka服务器,其他实例可以使用。
namespace eureka Get the namespace used to find properties. Ignored in Spring Cloud.
获取用于查找属性的命名空间,默认为eureka
non-secure-port 80 Get the non-secure port on which the instance should receive traffic.
获取该实例应该接收通信的非安全端口。默认为80
non-secure-port-enabled true Indicates whether the non-secure port should be enabled for traffic or not.
该实例应该接收通信的非安全端口是否启用,默认为true
secure-port 443 Get the Secure port on which the instance should receive traffic.
 获取该实例应该接收通信的安全端口,默认为443
secure-port-enabled false Indicates whether the secure port should be enabled for traffic or not.
该实例应该接收通信的安全端口是否启用,默认为false
secure-virtual-host-name unknown Gets the secure virtual host name defined for this instance. This is typically the way other instance would find this instance by using the secure virtual host name.Think of this as similar to the fully qualified domain name, that the users of your services will need to find this instance.

by 斯武丶风晴 https://my.oschina.net/langxSpirit

猜你喜欢

转载自my.oschina.net/langxSpirit/blog/1821251
今日推荐