首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >原 微服务Spring Cloud Eur

原 微服务Spring Cloud Eur

作者头像
斯武丶风晴
发布2018-06-08 15:49:34
7340
发布2018-06-08 15:49:34
举报
文章被收录于专栏:龙首琴剑庐龙首琴剑庐

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

常见配置

name (eureka.client.xxx开头配置)

defaultValue

description

service-url

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. 指定服务注册中心地址,类型为 HashMap,并设置有一组默认值,默认的Key为 defaultZone;默认的Value为 http://localhost:8761/eureka ,如果服务注册中心为高可用集群时,多个注册中心地址以逗号分隔。 如果服务注册中心加入了安全验证,这里配置的地址格式为: http://<username>:<password>@localhost:8761/eureka 其中 <username> 为安全校验的用户名;<password> 为该用户的密码

fetch-registry

true

Indicates whether this client should fetch eureka registry information from eureka server. 是否从 Eureka Server 获取注册信息

register-with-eureka

true

Indicates whether or not this instance should register its information with eureka server for discovery by others. In some cases, you do not want your instances to be discovered whereas you just want do discover other instances. 是否要将自身的实例信息注册到 Eureka Server

eureka-connection-idle-timeout-seconds

30

Indicates how much time (in seconds) that the HTTP connections to eureka server can stay idle before it can be closed. In the AWS environment, it is recommended that the values is 30 seconds or less, since the firewall cleans up the connection information after a few mins leaving the connection hanging in limbo Eureka Server连接空闲关闭时间,单位:秒

eureka-server-connect-timeout-seconds

5

Indicates how long to wait (in seconds) before a connection to eureka server needs to timeout. Note that the connections in the client are pooled by org.apache.http.client.HttpClient and this setting affects the actual connection creation and also the wait time to get the connection from the pool. 连接 Eureka Server 的超时时间,单位:秒

eureka-server-read-timeout-seconds

8

Indicates how long to wait (in seconds) before a read from eureka server needs to timeout. 读取 Eureka Server 信息的超时时间,单位:秒

eureka-server-total-connections

200

Gets the total number of connections that is allowed from eureka client to all eureka servers. 从 Eureka Client 到所有Eureka Server的连接总数

eureka-server-total-connections-per-host

50

Gets the total number of connections that is allowed from eureka client to a eureka server host. 从 Eureka Client 到每个 Eureka Server 主机的连接总数

eureka-service-url-poll-interval-seconds

0

Indicates how often(in seconds) to poll for changes to eureka server information. Eureka servers could be added or removed and this setting controls how soon the eureka clients should know about it. 轮询 Eureka Server 地址更改的间隔时间,单位:秒。 当我们与Spring CLoud Config整合,动态刷新Eureka的serviceURL地址时需要关注该参数

initial-instance-info-replication-interval-seconds

40

Indicates how long initially (in seconds) to replicate instance info to the eureka server 初始化实例信息到 Eureka  Server 的间隔时间,单位:秒

instance-info-replication-interval-seconds

30

Indicates how often(in seconds) to replicate instance changes to be replicated to the eureka server. 更新实例信息的变化到 Eureka Server 的间隔时间,单位:秒

registry-fetch-interval-seconds

30

Indicates how often(in seconds) to fetch the registry information from the eureka server. 从 Eureka Server 获取注册信息的间隔时间,单位:秒 对于api-gateway,如果要迅速获取服务注册状态,可以缩小该值,比如5秒

其他配置

name (eureka.client.xxx开头配置)

defaultValue

description

allow-redirects

false

Indicates whether server can redirect a client request to a backup server/cluster. If set to false, the server will handle the request directly, If set to true, it may send HTTP redirect to the client, with a new server location. 服务器是否能够重定向客户端请求到备份服务器。 如果设置为false,服务器将直接处理请求,如果设置为true,它可能发送HTTP重定向到客户端。默认为false

availability-zones

Gets the list of availability zones (used in AWS data centers) for the region in which this instance resides. The changes are effective at runtime at the next registry fetch cycle as specified by registryFetchIntervalSeconds.  获取实例所在的地区下可用性的区域列表,用逗号隔开。

backup-registry-impl

Gets the name of the implementation which implements BackupRegistry to fetch the registry information as a fall back option for only the first time when the eureka client starts. This may be needed for applications which needs additional resiliency for registry information without which it cannot operate. 获取实现了eureka客户端在第一次启动时读取注册表的信息作为回退选项的实现名称

cache-refresh-executor-exponential-back-off-bound

10

Cache refresh executor exponential back off related property. It is a maximum multiplier value for retry delay, in case where a sequence of timeouts occurred. 执行程序指数回退刷新的相关属性,是重试延迟的最大倍数值,默认为10

cache-refresh-executor-thread-pool-size

2

The thread pool size for the cacheRefreshExecutor to initialise with 执行程序缓存刷新线程池的大小,默认为2

client-data-accept

EurekaAccept name for client data accept

decoder-name

This is a transient config and once the latest codecs are stable, can be removed (as there will only be one)  这是一个短暂的解码器的配置,如果最新的解码器是稳定的,则可以去除,默认为null

disable-delta

false

Indicates whether the eureka client should disable fetching of delta and should rather resort to getting the full registry information. Note that the delta fetches can reduce the traffic tremendously, because the rate of change with the eureka server is normally much lower than the rate of fetches. The changes are effective at runtime at the next registry fetch cycle as specified by registryFetchIntervalSeconds

dollar-replacement

_-

Get a replacement string for Dollar sign <code>        eureka服务器序列化/反序列化的信息中获取“$”符号的的替换字符串。默认为“_-”

enabled

true

Flag to indicate that the Eureka client is enabled.

encoder-name

This is a transient config and once the latest codecs are stable, can be removed (as there will only be one) 这是一个短暂的编码器的配置,如果最新的编码器是稳定的,则可以去除,默认为null

escape-char-replacement

__

Get a replacement string for underscore sign <code>_</code> during serializing/deserializing information in eureka server.        eureka服务器序列化/反序列化的信息中获取“_”符号的的替换字符串。默认为“__”

eureka-server-d-n-s-name

Gets the DNS name to be queried to get the list of eureka servers.This information is not required if the contract returns the service urls by implementing serviceUrls. The DNS mechanism is used when useDnsForFetchingServiceUrls is set to true and the eureka client expects the DNS to configured a certain way so that it can fetch changing eureka servers dynamically. The changes are effective at runtime. 获取要查询的DNS名称来获得eureka服务器,此配置只有在eureka服务器ip地址列表是在DNS中才会用到。默认为null

eureka-server-port

Gets the port to be used to construct the service url to contact eureka server when the list of eureka servers come from the DNS.This information is not required if the contract returns the service urls eurekaServerServiceUrls(String). The DNS mechanism is used when useDnsForFetchingServiceUrls is set to true and the eureka client expects the DNS to configured a certain way so that it can fetch changing eureka servers dynamically. The changes are effective at runtime. 获取eureka服务器的端口,此配置只有在eureka服务器ip地址列表是在DNS中才会用到。默认为null

eureka-server-u-r-l-context

Gets the URL context to be used to construct the service url to contact eureka server when the list of eureka servers come from the DNS. This information is not required if the contract returns the service urls from eurekaServerServiceUrls. The DNS mechanism is used when useDnsForFetchingServiceUrls is set to true and the eureka client expects the DNS to configured a certain way so that it can fetch changing eureka servers dynamically. The changes are effective at runtime. 表示eureka注册中心的路径,如果配置为eureka,则为http://x.x.x.x:x/eureka/,在eureka的配置文件中加入此配置表示eureka作为客户端向注册中心注册,从而构成eureka集群。此配置只有在eureka服务器ip地址列表是在DNS中才会用到,默认为null

fetch-remote-regions-registry

Comma separated list of regions for which the eureka registry information will be fetched. It is mandatory to define the availability zones for each of these regions as returned by availabilityZones. Failing to do so, will result in failure of discovery client startup.  eureka服务注册表信息里的以逗号隔开的地区名单,如果不这样返回这些地区名单,则客户端启动将会出错。默认为null

filter-only-up-instances

true

Indicates whether to get the applications after filtering the applications for instances with only InstanceStatus UP states. 是否获得处于开启状态的实例的应用程序过滤之后的应用程序。默认为true

g-zip-content

true

Indicates whether the content fetched from eureka server has to be compressed whenever it is supported by the server. The registry information from the eureka server is compressed for optimum network traffic. eureka注册表的内容是否被压缩,默认为true,并且是在最好的网络流量下被压缩

heartbeat-executor-exponential-back-off-bound

10

Heartbeat executor exponential back off related property. It is a maximum multiplier value for retry delay, in case where a sequence of timeouts occurred. 心跳执行程序回退相关的属性,是重试延迟的最大倍数值,默认为10

heartbeat-executor-thread-pool-size

2

The thread pool size for the heartbeatExecutor to initialise with 心跳执行程序线程池的大小,默认为2

log-delta-diff

false

Indicates whether to log differences between the eureka server and the eureka client in terms of registry information. Eureka client tries to retrieve only delta changes from eureka server to minimize network traffic. After receiving the deltas, eureka client reconciles the information from the server to verify it has not missed out some information. Reconciliation failures could happen when the client has had network issues communicating to server.If the reconciliation fails, eureka client gets the full registry information. While getting the full registry information, the eureka client can log the differences between the client and the server and this setting controls that. The changes are effective at runtime at the next registry fetch cycle as specified by registryFetchIntervalSecondsr  是否记录eureka服务器和客户端之间在注册表的信息方面的差异,默认为false

on-demand-update-status-change

true

If set to true, local status updates via ApplicationInfoManager will trigger on-demand (but rate limited) register/updates to remote eureka servers 如果设置为true,客户端的状态更新将会点播更新到远程服务器上,默认为true

prefer-same-zone-eureka

true

Indicates whether or not this instance should try to use the eureka server in the same zone for latency and/or other reason. Ideally eureka clients are configured to talk to servers in the same zone The changes are effective at runtime at the next registry fetch cycle as specified by registryFetchIntervalSeconds 实例是否使用同一zone里的eureka服务器,默认为true,理想状态下,eureka客户端与服务端是在同一zone下

property-resolver

org.springframework.core.env.PropertyResolver

proxy-host

Gets the proxy host to eureka server if any. 获取eureka服务的代理主机,默认为null

proxy-password

Gets the proxy password if any. 获取eureka服务的代理密码,默认为null

proxy-port

Gets the proxy port to eureka server if any. 获取eureka服务的代理端口, 默认为null

proxy-user-name

Gets the proxy user name if any. 获取eureka服务的代理用户名,默认为null

region

us-east-1

Gets the region (used in AWS datacenters) where this instance resides. 获取实例所在的地区。默认为us-east-1

registry-refresh-single-vip-address

Indicates whether the client is only interested in the registry information for a single VIP. 此客户端只对一个单一的VIP注册表的信息感兴趣。默认为null

use-dns-for-fetching-service-urls

false

Indicates whether the eureka client should use the DNS mechanism to fetch a list of eureka servers to talk to. When the DNS name is updated to have additional servers, that information is used immediately after the eureka client polls for that information as specified in eurekaServiceUrlPollIntervalSeconds. Alternatively, the service urls can be returned serviceUrls, but the users should implement their own mechanism to return the updated list in case of changes. The changes are effective at runtime.  eureka客户端是否应该使用DNS机制来获取eureka服务器的地址列表,默认为false

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

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 常见配置
  • 其他配置
相关产品与服务
微服务引擎 TSE
微服务引擎(Tencent Cloud Service Engine)提供开箱即用的云上全场景微服务解决方案。支持开源增强的云原生注册配置中心(Zookeeper、Nacos 和 Apollo),北极星网格(腾讯自研并开源的 PolarisMesh)、云原生 API 网关(Kong)以及微服务应用托管的弹性微服务平台。微服务引擎完全兼容开源版本的使用方式,在功能、可用性和可运维性等多个方面进行增强。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档