diff --git a/multi/multi_spring-cloud-consul-discovery.html b/multi/multi_spring-cloud-consul-discovery.html index 7b2f4535..fc7be35d 100644 --- a/multi/multi_spring-cloud-consul-discovery.html +++ b/multi/multi_spring-cloud-consul-discovery.html @@ -19,7 +19,38 @@ consul: host: localhost port: 8500
-
![]() | Caution |
|---|---|
If you use Spring Cloud Consul Config, the above values will need to be placed in |
The default service name, instance id and port, taken from the Environment, are ${spring.application.name}, the Spring Context ID and ${server.port} respectively.
To disable the Consul Discovery Client you can set spring.cloud.consul.discovery.enabled to false.
To disable the service registration you can set spring.cloud.consul.discovery.register to false.
The health check for a Consul instance defaults to "/health", which is the default locations of a useful endpoint in a Spring Boot Actuator application. You need to change these, even for an Actuator application if you use a non-default context path or servlet path (e.g. server.servletPath=/foo) or management endpoint path (e.g. management.server.servlet.context-path=/admin). The interval that Consul uses to check the health endpoint may also be configured. "10s" and "1m" represent 10 seconds and 1 minute respectively. Example:
application.yml. +
![]() | Caution |
|---|---|
If you use Spring Cloud Consul Config, the above values will need to be placed in |
The default service name, instance id and port, taken from the Environment, are ${spring.application.name}, the Spring Context ID and ${server.port} respectively.
To disable the Consul Discovery Client you can set spring.cloud.consul.discovery.enabled to false.
To disable the service registration you can set spring.cloud.consul.discovery.register to false.
When management server port is set to something different than the application port, by setting management.server.port property, management service will be registered as a separate service than the application service. For example:
application.yml. +
spring: + application: + name: myApp +management: + server: + port: 4452
+
Above configuration will register following 2 services:
ID: myApp +Name: myApp
ID: myApp-management +Name: myApp-management
Management service will inherit its instanceId and serviceName from the application service. For example:
application.yml. +
spring:
+ application:
+ name: myApp
+management:
+ server:
+ port: 4452
+spring:
+ cloud:
+ consul:
+ discovery:
+ instance-id: custom-service-id
+ serviceName: myprefix-${spring.application.name}+
Above configuration will register following 2 services:
ID: custom-service-id +Name: myprefix-myApp
ID: custom-service-id-management +Name: myprefix-myApp-management
Further customization is possible via following properties:
/** Port to register the management service under (defaults to management port) */ +spring.cloud.consul.discovery.management-port + +/** Suffix to use when registering management service (defaults to "management" */ +spring.cloud.consul.discovery.management-suffix + +/** Tags to use when registering management service (defaults to "management" */ +spring.cloud.consul.discovery.management-tags
The health check for a Consul instance defaults to "/health", which is the default locations of a useful endpoint in a Spring Boot Actuator application. You need to change these, even for an Actuator application if you use a non-default context path or servlet path (e.g. server.servletPath=/foo) or management endpoint path (e.g. management.server.servlet.context-path=/admin). The interval that Consul uses to check the health endpoint may also be configured. "10s" and "1m" represent 10 seconds and 1 minute respectively. Example:
application.yml.
spring:
cloud:
consul:
diff --git a/multi/multi_spring-cloud-consul.html b/multi/multi_spring-cloud-consul.html
index c1a09520..173f48c3 100644
--- a/multi/multi_spring-cloud-consul.html
+++ b/multi/multi_spring-cloud-consul.html
@@ -1,3 +1,3 @@
- Spring Cloud Consul
\ No newline at end of file
+ Spring Cloud Consul Table of Contents
- 1. Install Consul
- 2. Consul Agent
- 3. Service Discovery with Consul
- 4. Distributed Configuration with Consul
- 5. Consul Retry
- 6. Spring Cloud Bus with Consul
- 7. Circuit Breaker with Hystrix
- 8. Hystrix metrics aggregation with Turbine and Consul