目前只包含 eurekaInstance配置和eurekaClient的配置信息
CloudEurekaTransportConfig
//客户端会话重连的时间
private int sessionedClientReconnectIntervalSeconds = 20 * 60;
//可重试的客户端隔离刷新百分比
private double retryableClientQuarantineRefreshPercentage = 0.66;
//引导解释器刷新时间间隔秒
private int bootstrapResolverRefreshIntervalSeconds = 5 * 60;
//应用解析器数据保存的 时间阈值
private int applicationsResolverDataStalenessThresholdSeconds = 5 * 60;
//异步冲突解决程序刷新间隔值
private int asyncResolverRefreshIntervalMs = 5 * 60 * 1000;
//异步冲突解决程序警告超时时间
private int asyncResolverWarmUpTimeoutMs = 5000;
private int asyncExecutorThreadPoolSize = 5;
//读集群vip???
private String readClusterVip;
//写集群vip???
private String writeClusterVip;
//引导解析器 查询?
private boolean bootstrapResolverForQuery = true;
//引导解析器策略
private String bootstrapResolverStrategy;
//应用解析器使用IP?
private boolean applicationsResolverUseIp = false;
---------------------------------------------------------------------------------------------------------------------------------------------------
EurekaClientConfigBean ------- 对应eureka.client中的配置信息
/**
* Default prefix for Eureka client config properties.
*/
public static final String PREFIX = "eureka.client";
/**
* Default Eureka URL.
*/
public static final String DEFAULT_URL = "http://localhost:8761" + DEFAULT_PREFIX
+ "/";
/**
* Default availability zone if none is resolved based on region.
*/
public static final String DEFAULT_ZONE = "defaultZone";
private static final int MINUTES = 60;
@Autowired(required = false)
PropertyResolver propertyResolver;
/**
* Flag to indicate that the Eureka client is enabled.
用于指示已启用Eureka客户端的标志。
*/
private boolean enabled = true;
@NestedConfigurationProperty
private EurekaTransportConfig transport = new CloudEurekaTransportConfig();
/**
从Eureka服务器获取注册表信息的频率
*/
private int registryFetchIntervalSeconds = 30;
/**
实例更改复制到Eureka服务器的频率
*/
private int instanceInfoReplicationIntervalSeconds = 30;
/**
最初将实例信息复制到Eureka服务器的时间
*/
private int initialInstanceInfoReplicationIntervalSeconds = 40;
/**
* 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服务器信息更改的频率(秒)。可以添加或删除Eureka服务器,此设置控制Eureka客户端了解它的时间。????
*/
private int eurekaServiceUrlPollIntervalSeconds = 5 * MINUTES;
/**
* 获取到Eureka服务器的代理端口(如果有)。
*/
private String proxyPort;
/**
* Gets the proxy host to eureka server if any.
*/
private String proxyHost;
/**
* Gets the proxy user name if any.
*/
private String proxyUserName;
/**
* Gets the proxy password if any.
*/
private String proxyPassword;
/**
从Eureka服务器读取需要超时之前等待的时间
*/
private int eurekaServerReadTimeoutSeconds = 8;
/**
* 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服务器需要超时之前等待的时间(秒)。请注意,客户端中的连接由
org.apache.http.client.http client和此设置会影响实际的连接创建以及从池中获取连接的等待时间。
*/
private int eurekaServerConnectTimeoutSeconds = 5;
/**
* 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.
获取实现backupregistry的信息以在Eureka客户端启动时作为返回选项获取注册表信息的实现的名称。
对于需要对注册表信息进行额外弹性的应用程序,如果没有这些信息,它将无法运行。
*/
private String backupRegistryImpl;
/**
* Gets the total number of connections that is allowed from eureka client to all
* eureka servers.
允许尤里卡客户端到服务端的所有的连接数
*/
private int eurekaServerTotalConnections = 200;
/**
* Gets the total number of connections that is allowed from eureka client to a eureka
* server host.
允许eureka客户端到一个服务端的总连接数
*/
private int eurekaServerTotalConnectionsPerHost = 50;
/**
* 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.
获取用于构造服务URL的URL上下文,以便在Eureka服务器列表来自DNS时与Eureka服务器联系。如果协定从eurekaserserviceurls返回服务URL,则不需要此信息。当usednsforfetchingserviceurls设置为true并且eureka客户端希望DNS以某种方式配置,以便可以动态获取更改的eureka服务器时,将使用DNS机制。这些更改在运行时有效。
*/
private String eurekaServerURLContext;
/**
* 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服务器列表来自DNS时用于构造与Eureka服务器联系的服务URL的端口。如果协定返回服务URL EurekaServerServiceURL(字符串),则不需要此信息。当usednsforfetchingserviceurls设置为true并且eureka客户机希望DNS以某种方式配置,以便它可以动态获取更改的eureka服务器时,使用DNS机制。这些更改在运行时有效。
*/
private String eurekaServerPort;
/**
* 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名称
*/
private String eurekaServerDNSName;
/**
* Gets the region (used in AWS datacenters) where this instance resides.
AWS云环境中的区域信息
*/
private String region = "us-east-1";
/**
* 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服务器的HTTP连接在关闭之前可以保持空闲的时间(秒)。
在AWS环境中,建议值不超过30秒,因为防火墙会在几分钟后清理连接信息,使连接挂起。
*/
private int eurekaConnectionIdleTimeoutSeconds = 30;
/**
* Indicates whether the client is only interested in the registry information for a
* single VIP.
客户端是否只对单个VIP的注册表信息感兴趣。
*/
private String registryRefreshSingleVipAddress;
/**
* The thread pool size for the heartbeatExecutor to initialise with.
*/
private int heartbeatExecutorThreadPoolSize = 2;
/**
* Heartbeat executor exponential back off related property. It is a maximum
* multiplier value for retry delay, in case where a sequence of timeouts occurred.
心跳执行器 指数后退界限相关属性。它是重试延迟的最大乘数值,以防发生一系列超时。????
*/
private int heartbeatExecutorExponentialBackOffBound = 10;
/**
* The thread pool size for the cacheRefreshExecutor to initialise with.
用在哪里的??
*/
private int cacheRefreshExecutorThreadPoolSize = 2;
/**
* 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.
缓存刷新执行器指数后退相关属性。
*/
private int cacheRefreshExecutorExponentialBackOffBound = 10;
/**
* 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服务器通信的完全限定的URL列表。每个值可以是一个单独的URL或一个以逗号分隔的备选位置列表。通常,Eureka服务器URL包含协议、主机、端口、上下文和版本信息(如果有)。例子:
http://ec2-256-156-243-129.compute-1.amazonaws.com:7001/eureka/
这些更改在运行时的下一个服务URL刷新周期(由eurekaserviceurlpollintervalseconds指定)时有效。
*/
private Map<String, String> serviceUrl = new HashMap<>();
{
this.serviceUrl.put(DEFAULT_ZONE, DEFAULT_URL);
}
/**
* 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服务器获取的内容。来自Eureka服务器的注册表信息被压缩以获得最佳网络流量。
*/
private boolean gZipContent = true;
/**
* 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服务器列表。当DNS名称更新为具有其他服务器时,该信息将在eureka客户机按照eurekaserviceurlpollintervalseconds中的指定对该信息进行轮询后立即使用。
或者,服务URL可以返回serviceURL,但是用户应该实现自己的机制,以便在发生更改时返回更新的列表。这些更改在运行时有效。
*/
private boolean useDnsForFetchingServiceUrls = false;
/**
* 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服务器注册其信息以供其他人发现。
在某些情况下,您不希望发现您的实例,而只希望发现其他实例。
*/
private boolean registerWithEureka = 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
出于延迟和/或其他原因,此实例是否应尝试在同一区域中使用Eureka服务器。
理想情况下,Eureka客户机配置为与同一区域中的服务器对话。
这些更改在运行时的下一个注册表提取周期(由registryfetchintervalseconds指定)时有效。
*/
private boolean preferSameZoneEureka = true;
/**
* 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服务器和Eureka客户端之间的差异。
Eureka客户端尝试仅从Eureka服务器检索增量更改,以最小化网络流量。在接收到delta之后,eureka客户机对来自服务器的信息进行协调,以验证它没有遗漏某些信息。
当客户端出现网络问题时,可能会发生协调失败。
正在与服务器通信。如果和解失败,则Eureka客户端将获得完整的
注册表信息。
获取完整的注册表信息时,Eureka客户机可以记录客户机和服务器之间的差异,此设置控制差异。
这些更改在运行时由registryfetchintervalsecondsr指定的下一个注册表提取循环中有效。
*/
private boolean logDeltaDiff;
/**
* 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
Eureka客户端是否应禁用提取delta,而应更倾向于获取完整的注册表信息。
请注意,增量获取可以极大地减少流量,因为Eureka服务器的更改率通常远低于获取率。
这些更改在运行时的下一个注册表提取周期(由registryfetchintervalseconds指定)时有效。
*/
private boolean disableDelta;
/**
* 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注册表信息的区域的逗号分隔列表。必须定义可用性区域返回的每个区域的可用性区域。否则,将导致发现客户端启动失败。
*
*/
private String fetchRemoteRegionsRegistry;
/**
此实例所在区域的可用性区域列表(在AWS数据中心中使用)。
这些更改在运行时由registryfetchintervalseconds指定的下一个注册表提取循环中有效。
*/
private Map<String, String> availabilityZones = new HashMap<>();
/**
* Indicates whether to get the applications after filtering the applications for
* instances with only InstanceStatus UP states.
指示筛选应用实例状态为up的应用。
*/
private boolean filterOnlyUpInstances = true;
/**
* Indicates whether this client should fetch eureka registry information from eureka
* server.
此客户端是否应从Eureka服务器获取Eureka注册表信息。
*/
private boolean fetchRegistry = true;
/**
* Get a replacement string for Dollar sign <code>$</code> during
* serializing/deserializing information in eureka server.
在eureka服务器中序列化/反序列化信息时,获取美元符号的替换字符串。
*/
private String dollarReplacement = "_-";
/**
* Get a replacement string for underscore sign <code>_</code> during serializing/
* deserializing information in eureka server.
*/
private String escapeCharReplacement = "__";
/**
* 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重定向,并使用新的服务器位置。
*/
private boolean allowRedirects = false;
/**
* If set to true, local status updates via ApplicationInfoManager will trigger
* on-demand (but rate limited) register/updates to remote eureka servers.
如果设置为true,则通过ApplicationInfoManager进行的本地状态更新将触发远程Eureka服务器的按需(但速率有限)注册/更新。
本地状态更细将触发远程状态的更新
*/
private boolean onDemandUpdateStatusChange = true;
/**
* This is a transient config and once the latest codecs are stable, can be removed
* (as there will only be one).
*/
private String encoderName;
/**
* This is a transient config and once the latest codecs are stable, can be removed
* (as there will only be one).
*/
private String decoderName;
/**
* EurekaAccept name for client data accept.
*/
private String clientDataAccept = EurekaAccept.full.name();
/**
* Indicates whether the client should explicitly unregister itself from the remote
* server on client shutdown.
客户端关闭时,客户端是否应显式从远程服务器注销自身。
*/
private boolean shouldUnregisterOnShutdown = true;
/**
* Indicates whether the client should enforce registration during initialization.
* Defaults to false.
客户端是否应在初始化期间强制注册
*/
private boolean shouldEnforceRegistrationAtInit = false;
/**
* Order of the discovery client used by `CompositeDiscoveryClient` for sorting
* available clients.
组件发现的顺序
*/
private int order = 0;
------------------------------------------------------------------------------------------------------------------------------
EurekaInstanceConfigBean--------------eureka实例的配置信息
private static final String UNKNOWN = "unknown";
private HostInfo hostInfo;
private InetUtils inetUtils;
/**
* Default prefix for actuator endpoints.
*/
private String actuatorPrefix = "/actuator";
/**
* Get the name of the application to be registered with eureka.
*/
private String appname = UNKNOWN;
/**
* Get the name of the application group to be registered with eureka.
*/
private String appGroupName;
/**
是否开启只要注册到eureka中,立即提供服务,有时程序需要做一些预处理工作在他能提供服务之前
*/
private boolean instanceEnabledOnit;
/**
http协议的端口,不安全端口
*/
private int nonSecurePort = 80;
/**
https协议的端口,安全端口
*/
private int securePort = 443;
/**
是否开启不安全端口
*/
private boolean nonSecurePortEnabled = true;
/**
是否开启安全端口 ,默认false
*/
private boolean securePortEnabled;
/**
指示Eureka客户机向Eureka服务器发送心跳以指示其仍处于活动状态的频率(秒)。如果在LeaseExpirationDurationInseconds中指定的时间段内未收到心跳信号,则Eureka服务器将通过禁止此实例的通信从其视图中删除该实例。
注意,如果实例实现healthcheckcallback,然后决定使其自身不可用,那么它仍然不能接受通信。
*/
private int leaseRenewalIntervalInSeconds = 30;
/**
指示Eureka服务器自接收到最后一个心跳信号后,在可以从其视图中删除此实例之前以及在不允许此实例通信的情况下等待的时间(秒)。
将此值设置得太长可能意味着流量可以路由到
实例,即使该实例不是活动的。将此值设置得太小可能意味着由于临时网络故障,该实例可能会失去通信。此值至少要设置为高于LeaseRenewalIntervalinSeconds中指定的值。
*/
private int leaseExpirationDurationInSeconds = 90;
/**
获取为此实例定义的虚拟主机名。
这通常是其他实例通过使用虚拟主机名。将其视为类似于完全限定的域名,即
您的服务的用户将需要找到此实例。
*/
private String virtualHostName = UNKNOWN;
/**
获取此实例的唯一ID(在AppName的作用域内)在Eureka注册。
*/
private String instanceId;
/**
安全虚拟主机名称
*/
private String secureVirtualHostName = UNKNOWN;
/**
获取与此实例关联的AWS自动缩放组名。此信息在AWS环境中专门用于在实例启动后自动将其退出服务,并且该实例已被禁用以进行通信。
这是aws云环境信息
*/
private String aSGName;
/**
获取与此实例关联的元数据名称/值对。此信息将发送到Eureka服务器,并可供其他实例使用。
*/
private Map<String, String> metadataMap = new HashMap<>();
/**
返回部署此实例的数据中心。如果实例部署在AWS中,则此信息用于获取一些特定于AWS的实例信息。
*/
private DataCenterInfo dataCenterInfo = new MyDataCenterInfo(
DataCenterInfo.Name.MyOwn);
/**
获取实例的IP地址。此信息仅用于学术目的,因为来自其他实例的通信主要使用@link gethostname(boolean)中提供的信息进行。
*/
private String ipAddress;
/**
获取此实例的相对状态页URL路径。然后,状态页URL由主机名和通信类型(安全或不安全)构成,如secureport和nonsecureport中指定的那样。
它通常用于其他服务查找有关此实例状态的信息目的。用户可以提供一个简单的HTML,指示实例的当前状态。
*/
private String statusPageUrlPath = actuatorPrefix + "/info";
/**
获取此实例的绝对状态页URL路径。如果状态页所在的实例与Eureka对话,则用户可以提供状态页URL路径;否则,如果实例是其他服务器的代理,则用户可以提供完整的URL。如果提供完整的URL,则优先。它通常用于其他服务查找有关此实例状态的信息目的。用户可以提供一个简单的HTML,指示实例的当前状态。
*/
private String statusPageUrl;
/**
* 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.
主页相对路径
*/
private String homePageUrlPath = "/";
/**
* 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://${eureka.hostname}:7001/
* where the value ${eureka.hostname} is replaced at runtime.
主页绝对路径
*/
private String homePageUrl;
/**
* 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路径。然后,健康检查页URL由主机名和通信类型(安全或不安全)构建,如SecurePort和NonSecureReport中指定的那样。它通常用于根据实例的健康状况做出有教育意义的决策,例如,它可以用于确定是对整个农场进行部署,还是停止部署而不造成进一步的损害。
*/
private String healthCheckUrlPath = actuatorPrefix + "/health";
/**
* 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://${eureka.hostname}:7001/ where the value
* ${eureka.hostname} is replaced at runtime.
*/
private String healthCheckUrl;
/**
* 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://${eureka.hostname}:7001/ where the value
* ${eureka.hostname} is replaced at runtime.
*/
private String secureHealthCheckUrl;
/**
* Get the namespace used to find properties. Ignored in Spring Cloud.
*/
private String namespace = "eureka";
/**
* The hostname if it can be determined at configuration time (otherwise it will be
* guessed from OS primitives).
*/
private String hostname;
/**
* 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.
*/
private boolean preferIpAddress = false;
/**
* Initial status to register with remote Eureka server.
*/
private InstanceStatus initialStatus = InstanceStatus.UP;
private String[] defaultAddressResolutionOrder = new String[0];
private Environment environment;