From 11e8700235a6f12dca5f917e43f7e8bbda674226 Mon Sep 17 00:00:00 2001 From: buildmaster Date: Wed, 27 Sep 2017 16:57:01 +0000 Subject: [PATCH] Sync docs from 2.0.x to gh-pages --- 2.0.x/multi/multi_spring-cloud-consul-discovery.html | 3 +-- 2.0.x/multi/multi_spring-cloud-consul-turbine.html | 1 - 2.0.x/single/spring-cloud-consul.html | 4 +--- 2.0.x/spring-cloud-consul.xml | 6 ++---- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/2.0.x/multi/multi_spring-cloud-consul-discovery.html b/2.0.x/multi/multi_spring-cloud-consul-discovery.html index e5e9901c..80cdf1e6 100644 --- a/2.0.x/multi/multi_spring-cloud-consul-discovery.html +++ b/2.0.x/multi/multi_spring-cloud-consul-discovery.html @@ -1,7 +1,6 @@ 3. Service Discovery with Consul

3. Service Discovery with Consul

Service Discovery is one of the key tenets of a microservice based architecture. Trying to hand configure each client or some form of convention can be very difficult to do and can be very brittle. Consul provides Service Discovery services via an HTTP API and DNS. Spring Cloud Consul leverages the HTTP API for service registration and discovery. This does not prevent non-Spring Cloud applications from leveraging the DNS interface. Consul Agents servers are run in a cluster that communicates via a gossip protocol and uses the Raft consensus protocol.

3.1 How to activate

To activate Consul Service Discovery use the starter with group org.springframework.cloud and artifact id spring-cloud-starter-consul-discovery. See the Spring Cloud Project page for details on setting up your build system with the current Spring Cloud Release Train.

3.2 Registering with Consul

When a client registers with Consul, it provides meta-data about itself such as host and port, id, name and tags. An HTTP Check is created by default that Consul hits the /health endpoint every 10 seconds. If the health check fails, the service instance is marked as critical.

Example Consul client:

@SpringBootApplication
-@EnableDiscoveryClient
 @RestController
 public class Application {
 
@@ -20,7 +19,7 @@
     consul:
       host: localhost
       port: 8500

-

[Caution]Caution

If you use Spring Cloud Consul Config, the above values will need to be placed in bootstrap.yml instead of application.yml.

The default service name, instance id and port, taken from the Environment, are ${spring.application.name}, the Spring Context ID and ${server.port} respectively.

@EnableDiscoveryClient make the app into both a Consul "service" (i.e. it registers itself) and a "client" (i.e. it can query Consul to locate other services).

3.3 HTTP Health Check

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.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]Caution

If you use Spring Cloud Consul Config, the above values will need to be placed in bootstrap.yml instead of application.yml.

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.

3.3 HTTP Health Check

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.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/2.0.x/multi/multi_spring-cloud-consul-turbine.html b/2.0.x/multi/multi_spring-cloud-consul-turbine.html
index 4a9605a2..807a187c 100644
--- a/2.0.x/multi/multi_spring-cloud-consul-turbine.html
+++ b/2.0.x/multi/multi_spring-cloud-consul-turbine.html
@@ -18,7 +18,6 @@ turbine:
   appConfig: ${applications}

The clusterConfig and appConfig sections must match, so it’s useful to put the comma-separated list of service ID’s into a separate configuration property.

Turbine.java. 

@EnableTurbine
-@EnableDiscoveryClient
 @SpringBootApplication
 public class Turbine {
     public static void main(String[] args) {
diff --git a/2.0.x/single/spring-cloud-consul.html b/2.0.x/single/spring-cloud-consul.html
index 20827f5c..f9f202b2 100644
--- a/2.0.x/single/spring-cloud-consul.html
+++ b/2.0.x/single/spring-cloud-consul.html
@@ -7,7 +7,6 @@ application and build large distributed systems with Consul based components. Th
 patterns provided include Service Discovery, Control Bus and Configuration.
 Intelligent Routing (Zuul) and Client Side Load Balancing (Ribbon), Circuit Breaker
 (Hystrix) are provided by integration with Spring Cloud Netflix.

1. Install Consul

Please see the installation documentation for instructions on how to install Consul.

2. Consul Agent

A Consul Agent client must be available to all Spring Cloud Consul applications. By default, the Agent client is expected to be at localhost:8500. See the Agent documentation for specifics on how to start an Agent client and how to connect to a cluster of Consul Agent Servers. For development, after you have installed consul, you may start a Consul Agent using the following command:

./src/main/bash/local_run_consul.sh

This will start an agent in server mode on port 8500, with the ui available at http://localhost:8500

3. Service Discovery with Consul

Service Discovery is one of the key tenets of a microservice based architecture. Trying to hand configure each client or some form of convention can be very difficult to do and can be very brittle. Consul provides Service Discovery services via an HTTP API and DNS. Spring Cloud Consul leverages the HTTP API for service registration and discovery. This does not prevent non-Spring Cloud applications from leveraging the DNS interface. Consul Agents servers are run in a cluster that communicates via a gossip protocol and uses the Raft consensus protocol.

3.1 How to activate

To activate Consul Service Discovery use the starter with group org.springframework.cloud and artifact id spring-cloud-starter-consul-discovery. See the Spring Cloud Project page for details on setting up your build system with the current Spring Cloud Release Train.

3.2 Registering with Consul

When a client registers with Consul, it provides meta-data about itself such as host and port, id, name and tags. An HTTP Check is created by default that Consul hits the /health endpoint every 10 seconds. If the health check fails, the service instance is marked as critical.

Example Consul client:

@SpringBootApplication
-@EnableDiscoveryClient
 @RestController
 public class Application {
 
@@ -26,7 +25,7 @@ Intelligent Routing (Zuul) and Client Side Load Balancing (Ribbon), Circuit Brea
     consul:
       host: localhost
       port: 8500

-

[Caution]Caution

If you use Spring Cloud Consul Config, the above values will need to be placed in bootstrap.yml instead of application.yml.

The default service name, instance id and port, taken from the Environment, are ${spring.application.name}, the Spring Context ID and ${server.port} respectively.

@EnableDiscoveryClient make the app into both a Consul "service" (i.e. it registers itself) and a "client" (i.e. it can query Consul to locate other services).

3.3 HTTP Health Check

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.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]Caution

If you use Spring Cloud Consul Config, the above values will need to be placed in bootstrap.yml instead of application.yml.

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.

3.3 HTTP Health Check

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.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:
@@ -115,7 +114,6 @@ turbine:
   appConfig: ${applications}

The clusterConfig and appConfig sections must match, so it’s useful to put the comma-separated list of service ID’s into a separate configuration property.

Turbine.java. 

@EnableTurbine
-@EnableDiscoveryClient
 @SpringBootApplication
 public class Turbine {
     public static void main(String[] args) {
diff --git a/2.0.x/spring-cloud-consul.xml b/2.0.x/spring-cloud-consul.xml
index 23fee3ba..71761fdd 100644
--- a/2.0.x/spring-cloud-consul.xml
+++ b/2.0.x/spring-cloud-consul.xml
@@ -4,7 +4,7 @@
 
 
 Spring Cloud Consul
-2017-09-07
+2017-09-27
 
 
 
@@ -39,7 +39,6 @@ Intelligent Routing (Zuul) and Client Side Load Balancing (Ribbon), Circuit Brea
 When a client registers with Consul, it provides meta-data about itself such as host and port, id, name and tags.  An HTTP Check is created by default that Consul hits the /health endpoint every 10 seconds.  If the health check fails, the service instance is marked as critical.
 Example Consul client:
 @SpringBootApplication
-@EnableDiscoveryClient
 @RestController
 public class Application {
 
@@ -68,7 +67,7 @@ public class Application {
 If you use Spring Cloud Consul Config, the above values will need to be placed in bootstrap.yml instead of application.yml.
 
 The default service name, instance id and port, taken from the Environment, are ${spring.application.name}, the Spring Context ID and ${server.port} respectively.
-@EnableDiscoveryClient make the app into both a Consul "service" (i.e. it registers itself) and a "client" (i.e. it can query Consul to locate other services).
+To disable the Consul Discovery Client you can set spring.cloud.consul.discovery.enabled to false.
 
 
HTTP Health Check @@ -295,7 +294,6 @@ turbine: Turbine.java @EnableTurbine -@EnableDiscoveryClient @SpringBootApplication public class Turbine { public static void main(String[] args) {