[] Eureka common configuration parsing springcloud

Transfer: https: //www.cnblogs.com/zyon/p/11023750.html

1. parsing configuration items

1.1-class arrangement

# Application name, the name will be displayed in the application interface Eureka column 
spring.application.name config-Service = 

# application port, Eureka server default: 8761 
server.port = 3333

1.2 eureka.server prefix configuration items

# Whether to allow self-protection mode is turned on by default: to true 
# Eureka server in a short time when excessive loss of clients, self-protection mode allows the server no longer delete a customer loses connection end 
eureka.server.enable-self- = to false Preservation 

# the Peer node update interval, unit: ms 
eureka.server.peer-Eureka-nodes-update-interval the MS-= 

# cleaning the Eureka server node inactive time interval, unit: ms default: 60,000, i.e., 60 seconds 
eureka.server.eviction-interval-timer-in- ms = 60000

  

1.3 eureka.instance prefix configuration items

# Service name, default configuration values take spring.application.name, if none Unknown 
eureka.instance.appname = eureka-Client 

# instance ID 
eureka.instance.instance-eureka-Client-ID = instance1 

# hostname Application Example 
eureka = localhost .instance.hostname 

# clients to use their own IP at registration instead of the host name, default: false 
eureka.instance.prefer-ip-address = false 

# application examples IP 
eureka.instance.ip-address = 127.0. 0.1 

# service time to failure, failure of the service will be removed. Unit: seconds Default: 90 
eureka.instance.lease-expiration--in-seconds The DURATION = 90 

# renewal service (heartbeat) frequency, unit: seconds, default 30 
eureka.instance.lease-Renewal-interval The-IN- = 30 seconds the 

# status page uRL, a relative path, using the default HTTP access for the use of HTTPS will have to use an absolute path configuration, default: / info 
eureka.instance.status-page-url-path = / info

/ Health: URL # health check page, a relative path, using the default HTTP access for the use of HTTPS will have to use an absolute path configuration, the default 
health eureka.instance.health-check-url-path = /

1.4 eureka.client prefix

# Eureka server address, type HashMap, the default Key to defaultZone; Value is the default HTTP: // localhost: 8761 / Eureka 
# If the service registry when high-availability cluster, multiple registries addresses separated by commas . 
= HTTP-url.defaultZone eureka.client.service: // $ {eureka.instance.hostname}: $ {server.port} / Eureka 

# whether to register itself to the registry, default: true 
under # Generally, Eureka Service end do not need to re-register their 
eureka.client.register-with-Eureka to true = 

# whether to obtain registration information from Eureka, default: true 
under # generally, Eureka server is not required 
eureka.client.fetch-registry to true = 

# client pull service registration information interval, unit: seconds default: 30 
eureka.client.registry-fETCH-interval The 30-seconds The = 

# whether to enable client health checks 
eureka.client.health-check.enabled = to true 

# 
eureka.client.eureka---Service-poll-interval The URL = 60-seconds The 
 
# Eureka server connection timeout, unit: sec default: 5
eureka.client.eureka-Connect-Server--seconds The timeout. 5 =

# Eureka reading information from the server timeout, unit: seconds, default:. 8 
eureka.client.eureka-Server-Read-seconds The timeout =. 8- 

# only if getting hold Examples UP instance, default: to true 
eureka.client.filter-only-instances-up to true = 

# off the Eureka server connection idle time, unit: seconds, default: 30 
eureka.client.eureka-connection-iDLE-timeout = 30 seconds the- 

# from Eureka Eureka client to the total number of connections to all services, defaulted: 200 
eureka.client.eureka-Server-connections-total = 200 

# from Eureka Eureka client to the total number of connections for each service host, default: 50 
eureka.client .eureka-server-total-connections- per-host = 50

2. Item Description

Eureka has some configuration items, you can probably know it by looking at the meaning of the information online, but if there is no intuitive guidance, and can not clearly understand their actual effects. Following are explanation of the configuration items by partial screenshot.

2.1 spring.application.name和eureka.instance.appname

At the same time configuration, eureka.instance.appnamea higher priority.

If no eureka.instance.appname, then use spring.application.namethe value, even if spring.application.namenot configured, the Unknown .

The configuration item corresponding to the contents of the red box interface Eureka:

2.2 eureka.instance.instance-id

CI eureka.instance.instance-idvalue determines display contents of the right side in the red box:

If not set eureka.instance.instance-id, then the value displayed will be generated by a number automatically determine Eureka:

2.3 eureka.instance.prefer-ip-address、eureka.instance.hostname、eureka.instance.ip-address

CI eureka.instance prefix, these burning absolute configuration items brain, according to Zhou's blog , at eureka.instance.prefer-ip-address = truethe time, using the examples of priority eureka.instance.ip-addressvalues to register, if not configured eureka.instance.ip-address, then the first non-loopback IP address to register .

At this point, we open the Eureka interface, in the example on the right, copy link address; or the mouse on the link under the map at the top right (do not click), you can get the address of the instance, as shown bottom left corner, you can see examples of this time registration is IP:

And when eureka.instance.prefer-ip-address = falsethe time, the same way you can see examples of registered addresses in the host name eureka.instance.hostnamevalue:

3. Configure Bean source code

Finally, corresponding to the configuration items appearing herein, the Eureka source class defined as follows.

eureka.server prefix configuration items

org.springframework.cloud.netflix.eureka.server.EurekaServerConfigBean

eureka.instance prefix configuration items

org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean

eureka.client prefix configuration items

org.springframework.cloud.netflix.eureka.EurekaClientConfigBean

  

Guess you like

Origin www.cnblogs.com/wjqhuaxia/p/11966542.html