Service registration class configuration

  • Specify registry eureka. Client. ServiceUrl. DefaultZone = http://localhost:${server port} / had been/configuration values stored in a HashMap, the default key for defaultZone, The default value is http://localhost:8761/eureka/ configure high availability registry, you can configure multiple registry, multiple urls to use commas Add security check to service registry, http://:@localhost:1111/eurekaa/
  • Other configuration Compiled under the org.springframework.cloud.net flix. Eureka. EurekaClient – ConfigBean defined in a common configuration parameters and the corresponding instructions and the default, these parameters with eureka. Client as the prefix
Parameter names instructions The default value
enable Enable the Eureka client true
eureka.client.registry-fetch-interval-seconds Interval for obtaining registration information from the Eureka server, in seconds 30
eureka.client.initial-instance-info-replication-interval-seconds Interval (in seconds) between updated instance information changes to the Eureka server 30
eureka.client.initial-instance-info-replication-interval-seconds Interval for initializing instance information to the Eureka server, in seconds 40
eureka.client.eureka-service-url-poll-interval-seconds Interval for polling eureka server address changes, in seconds. We need to pay attention to this parameter when we work with Spring Cloud Config to dynamically refresh Eureka’s serviceURL address 300
eureka.client.eureka-server-read-timeout-seconds Timeout period for reading EureKA information, expressed in seconds 8
eureka.client.eureka-server-connect-timeout-seconds Eureka timeout, in seconds 5
eureka.client.eureka-server-total-connections Total number of connections from eureka clients to all Eureka servers 200
eureka.client.eureka-server-total-connections-per-host The total number of connections from eureka clients to each Eureka host 50
eureka.client.eureka-connection-idle-timeout-seconds Idle shutdown time of eureka server connection, in seconds 30
eureka.client.heartbeat-executor-thread-pool-size Number of initialization threads for the heartbeat connection pool 2
eureka.client.heartbeat-executor-exponential-back-off-bound Maximum multiplication of the heartbeat timeout retry delay 10
eureka.client.cache-refresh-executor-thread-pool-size Cache the number of initialized threads in the flush thread pool 2
eureka.client.cache-refresh-executor-exponential-back-off-bound= Maximum times the cache flush retry delay 10
eureka.client.use-dns-for-fetching-service-urls Use DNS to obtain the serviceUrl of eureka server false
eureka.client.register-with-eureka Whether to register its instance information with the Eureka server true
eureka.client.prefer-same-zone-eureka Whether the Eureka server in the same zone is preferred true
eureka.client.filter-only-up-instances= Whether to filter when obtaining instances. Only instances in up state are retained true
eureka.client.fetch-registry Whether to obtain registration information from eureka server true

Service instance class configuration

By org.springframework.cloud.net flix. Eureka. EurekaInstanceConfigBean source to get the details, the configuration information in eureka. The instance for the prefix.

  • Instance name A unique identifier that identifies different instances of a service. Eureka. Instance. InstanceId in springcloud default rules: ${spring.cloud.client.hostname}:${spring.application.name}:${spring.application.instance_id:${server.port}} For instance name naming rules through eureka. The instance. The instanceId parameters configuration Such as: eureka. Instance. InstanceId = ${spirng. Applicaiton. Name} : ${random. Int}

  • Some of the endpoint configuration in InstanceInfo URL configuration information, such as homePageUrl statusPageUrl, healthCheckUrl respectively represent the application’s home page URL, state the URL of the page, the URL for the health check. In spring Cloud Eureka, the urls of state and health check use /info breakpoints and /health endpoints provided by the Spirng-boot-Actuator module by default. Through eureka. Instance. StatusPageUrlPath = / hello/info eureka. Instance. HealthCheckUrlPath = / hello/checkhealth path to modify the page

  • Health detection Without the spring-Cloud-skeleton-actuator module, health detection of service instances is implemented by heartbeat of clients. The default heartbeat implementation mode can be used to check whether the client process is running properly, but it cannot ensure that the client application can provide services normally, such as database, cache, message connection is unavailable. This time will need to introduce the spring – cloud – physical modules, and configure the eureka. Client. Healthcheck. Enable = true.

  • Other configuration

Parameter names instructions The default value
eureka.instance.prefer-ip-address Whether to preferentially use IP addresses as host names false
eureka.instance.lease-renewal-interval-in-seconds The interval, in seconds, at which the Eureka client wants the server to send the heartbeat 30
eureka.instance.lease-expiration-duration-in-seconds The upper limit of the Eureka server waiting time after receiving the last heartbeat, in seconds. After this time, the server removes the service instance from the service list, preventing service invocation requests from being sent to the instance 90
eureka.instance.appname The default value is spring.application.name. If there is no service name, the default value is unknown
eureka.instance.virtual-host-name If this parameter is not specified, the value is obtained based on the host name of the operating system