Sync docs from master to gh-pages
This commit is contained in:
@@ -19,7 +19,38 @@
|
||||
consul:
|
||||
host: localhost
|
||||
port: 8500</pre><p>
|
||||
</p><div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td><th align="left">Caution</th></tr><tr><td align="left" valign="top"><p>If you use <a class="link" href="multi_spring-cloud-consul-config.html" title="4. Distributed Configuration with Consul">Spring Cloud Consul Config</a>, the above values will need to be placed in <code class="literal">bootstrap.yml</code> instead of <code class="literal">application.yml</code>.</p></td></tr></table></div><p>The default service name, instance id and port, taken from the <code class="literal">Environment</code>, are <code class="literal">${spring.application.name}</code>, the Spring Context ID and <code class="literal">${server.port}</code> respectively.</p><p>To disable the Consul Discovery Client you can set <code class="literal">spring.cloud.consul.discovery.enabled</code> to <code class="literal">false</code>.</p><p>To disable the service registration you can set <code class="literal">spring.cloud.consul.discovery.register</code> to <code class="literal">false</code>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_http_health_check" href="#_http_health_check"></a>3.3 HTTP Health Check</h2></div></div></div><p>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. <code class="literal">server.servletPath=/foo</code>) or management endpoint path (e.g. <code class="literal">management.server.servlet.context-path=/admin</code>). 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:</p><p><b>application.yml. </b>
|
||||
</p><div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td><th align="left">Caution</th></tr><tr><td align="left" valign="top"><p>If you use <a class="link" href="multi_spring-cloud-consul-config.html" title="4. Distributed Configuration with Consul">Spring Cloud Consul Config</a>, the above values will need to be placed in <code class="literal">bootstrap.yml</code> instead of <code class="literal">application.yml</code>.</p></td></tr></table></div><p>The default service name, instance id and port, taken from the <code class="literal">Environment</code>, are <code class="literal">${spring.application.name}</code>, the Spring Context ID and <code class="literal">${server.port}</code> respectively.</p><p>To disable the Consul Discovery Client you can set <code class="literal">spring.cloud.consul.discovery.enabled</code> to <code class="literal">false</code>.</p><p>To disable the service registration you can set <code class="literal">spring.cloud.consul.discovery.register</code> to <code class="literal">false</code>.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_registering_management_as_a_separate_service" href="#_registering_management_as_a_separate_service"></a>3.2.1 Registering Management as a Separate Service</h3></div></div></div><p>When management server port is set to something different than the application port, by setting <code class="literal">management.server.port</code> property, management service will be registered as a separate service than the application service. For example:</p><p><b>application.yml. </b>
|
||||
</p><pre class="screen">spring:
|
||||
application:
|
||||
name: myApp
|
||||
management:
|
||||
server:
|
||||
port: 4452</pre><p>
|
||||
</p><p>Above configuration will register following 2 services:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Application Service:</li></ul></div><pre class="screen">ID: myApp
|
||||
Name: myApp</pre><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Management Service:</li></ul></div><pre class="screen">ID: myApp-management
|
||||
Name: myApp-management</pre><p>Management service will inherit its <code class="literal">instanceId</code> and <code class="literal">serviceName</code> from the application service. For example:</p><p><b>application.yml. </b>
|
||||
</p><pre class="screen">spring:
|
||||
application:
|
||||
name: myApp
|
||||
management:
|
||||
server:
|
||||
port: 4452
|
||||
spring:
|
||||
cloud:
|
||||
consul:
|
||||
discovery:
|
||||
instance-id: custom-service-id
|
||||
serviceName: myprefix-${spring.application.name}</pre><p>
|
||||
</p><p>Above configuration will register following 2 services:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Application Service:</li></ul></div><pre class="screen">ID: custom-service-id
|
||||
Name: myprefix-myApp</pre><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Management Service:</li></ul></div><pre class="screen">ID: custom-service-id-management
|
||||
Name: myprefix-myApp-management</pre><p>Further customization is possible via following properties:</p><pre class="screen">/** 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</pre></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_http_health_check" href="#_http_health_check"></a>3.3 HTTP Health Check</h2></div></div></div><p>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. <code class="literal">server.servletPath=/foo</code>) or management endpoint path (e.g. <code class="literal">management.server.servlet.context-path=/admin</code>). 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:</p><p><b>application.yml. </b>
|
||||
</p><pre class="screen">spring:
|
||||
cloud:
|
||||
consul:
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
||||
<html><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Spring Cloud Consul</title><link rel="stylesheet" type="text/css" href="css/manual-singlepage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div lang="en" class="book"><div class="titlepage"><div><div><h1 class="title"><a name="d0e3"></a>Spring Cloud Consul</h1></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="preface"><a href="#d0e9"></a></span></dt><dt><span class="chapter"><a href="#spring-cloud-consul-install">1. Install Consul</a></span></dt><dt><span class="chapter"><a href="#spring-cloud-consul-agent">2. Consul Agent</a></span></dt><dt><span class="chapter"><a href="#spring-cloud-consul-discovery">3. Service Discovery with Consul</a></span></dt><dd><dl><dt><span class="section"><a href="#_how_to_activate">3.1. How to activate</a></span></dt><dt><span class="section"><a href="#_registering_with_consul">3.2. Registering with Consul</a></span></dt><dt><span class="section"><a href="#_http_health_check">3.3. HTTP Health Check</a></span></dt><dd><dl><dt><span class="section"><a href="#_metadata_and_consul_tags">3.3.1. Metadata and Consul tags</a></span></dt><dt><span class="section"><a href="#_making_the_consul_instance_id_unique">3.3.2. Making the Consul Instance ID Unique</a></span></dt><dt><span class="section"><a href="#_applying_headers_to_health_check_requests">3.3.3. Applying Headers to Health Check Requests</a></span></dt></dl></dd><dt><span class="section"><a href="#_looking_up_services">3.4. Looking up services</a></span></dt><dd><dl><dt><span class="section"><a href="#_using_ribbon">3.4.1. Using Ribbon</a></span></dt><dt><span class="section"><a href="#_using_the_discoveryclient">3.4.2. Using the DiscoveryClient</a></span></dt></dl></dd><dt><span class="section"><a href="#_consul_catalog_watch">3.5. Consul Catalog Watch</a></span></dt></dl></dd><dt><span class="chapter"><a href="#spring-cloud-consul-config">4. Distributed Configuration with Consul</a></span></dt><dd><dl><dt><span class="section"><a href="#_how_to_activate_2">4.1. How to activate</a></span></dt><dt><span class="section"><a href="#_customizing">4.2. Customizing</a></span></dt><dt><span class="section"><a href="#spring-cloud-consul-config-watch">4.3. Config Watch</a></span></dt><dt><span class="section"><a href="#spring-cloud-consul-config-format">4.4. YAML or Properties with Config</a></span></dt><dt><span class="section"><a href="#spring-cloud-consul-config-git2consul">4.5. git2consul with Config</a></span></dt><dt><span class="section"><a href="#spring-cloud-consul-failfast">4.6. Fail Fast</a></span></dt></dl></dd><dt><span class="chapter"><a href="#spring-cloud-consul-retry">5. Consul Retry</a></span></dt><dt><span class="chapter"><a href="#spring-cloud-consul-bus">6. Spring Cloud Bus with Consul</a></span></dt><dd><dl><dt><span class="section"><a href="#_how_to_activate_3">6.1. How to activate</a></span></dt></dl></dd><dt><span class="chapter"><a href="#spring-cloud-consul-hystrix">7. Circuit Breaker with Hystrix</a></span></dt><dt><span class="chapter"><a href="#spring-cloud-consul-turbine">8. Hystrix metrics aggregation with Turbine and Consul</a></span></dt></dl></div><div class="preface"><div class="titlepage"><div><div><h1 class="title"><a name="d0e9" href="#d0e9"></a></h1></div></div></div><p><span class="strong"><strong>2.1.0.BUILD-SNAPSHOT</strong></span></p><p>This project provides Consul integrations for Spring Boot apps through autoconfiguration
|
||||
<title>Spring Cloud Consul</title><link rel="stylesheet" type="text/css" href="css/manual-singlepage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div lang="en" class="book"><div class="titlepage"><div><div><h1 class="title"><a name="d0e3"></a>Spring Cloud Consul</h1></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="preface"><a href="#d0e9"></a></span></dt><dt><span class="chapter"><a href="#spring-cloud-consul-install">1. Install Consul</a></span></dt><dt><span class="chapter"><a href="#spring-cloud-consul-agent">2. Consul Agent</a></span></dt><dt><span class="chapter"><a href="#spring-cloud-consul-discovery">3. Service Discovery with Consul</a></span></dt><dd><dl><dt><span class="section"><a href="#_how_to_activate">3.1. How to activate</a></span></dt><dt><span class="section"><a href="#_registering_with_consul">3.2. Registering with Consul</a></span></dt><dd><dl><dt><span class="section"><a href="#_registering_management_as_a_separate_service">3.2.1. Registering Management as a Separate Service</a></span></dt></dl></dd><dt><span class="section"><a href="#_http_health_check">3.3. HTTP Health Check</a></span></dt><dd><dl><dt><span class="section"><a href="#_metadata_and_consul_tags">3.3.1. Metadata and Consul tags</a></span></dt><dt><span class="section"><a href="#_making_the_consul_instance_id_unique">3.3.2. Making the Consul Instance ID Unique</a></span></dt><dt><span class="section"><a href="#_applying_headers_to_health_check_requests">3.3.3. Applying Headers to Health Check Requests</a></span></dt></dl></dd><dt><span class="section"><a href="#_looking_up_services">3.4. Looking up services</a></span></dt><dd><dl><dt><span class="section"><a href="#_using_ribbon">3.4.1. Using Ribbon</a></span></dt><dt><span class="section"><a href="#_using_the_discoveryclient">3.4.2. Using the DiscoveryClient</a></span></dt></dl></dd><dt><span class="section"><a href="#_consul_catalog_watch">3.5. Consul Catalog Watch</a></span></dt></dl></dd><dt><span class="chapter"><a href="#spring-cloud-consul-config">4. Distributed Configuration with Consul</a></span></dt><dd><dl><dt><span class="section"><a href="#_how_to_activate_2">4.1. How to activate</a></span></dt><dt><span class="section"><a href="#_customizing">4.2. Customizing</a></span></dt><dt><span class="section"><a href="#spring-cloud-consul-config-watch">4.3. Config Watch</a></span></dt><dt><span class="section"><a href="#spring-cloud-consul-config-format">4.4. YAML or Properties with Config</a></span></dt><dt><span class="section"><a href="#spring-cloud-consul-config-git2consul">4.5. git2consul with Config</a></span></dt><dt><span class="section"><a href="#spring-cloud-consul-failfast">4.6. Fail Fast</a></span></dt></dl></dd><dt><span class="chapter"><a href="#spring-cloud-consul-retry">5. Consul Retry</a></span></dt><dt><span class="chapter"><a href="#spring-cloud-consul-bus">6. Spring Cloud Bus with Consul</a></span></dt><dd><dl><dt><span class="section"><a href="#_how_to_activate_3">6.1. How to activate</a></span></dt></dl></dd><dt><span class="chapter"><a href="#spring-cloud-consul-hystrix">7. Circuit Breaker with Hystrix</a></span></dt><dt><span class="chapter"><a href="#spring-cloud-consul-turbine">8. Hystrix metrics aggregation with Turbine and Consul</a></span></dt></dl></div><div class="preface"><div class="titlepage"><div><div><h1 class="title"><a name="d0e9" href="#d0e9"></a></h1></div></div></div><p><span class="strong"><strong>2.1.0.BUILD-SNAPSHOT</strong></span></p><p>This project provides Consul integrations for Spring Boot apps through autoconfiguration
|
||||
and binding to the Spring Environment and other Spring programming model idioms. With a few
|
||||
simple annotations you can quickly enable and configure the common patterns inside your
|
||||
application and build large distributed systems with Consul based components. The
|
||||
@@ -25,7 +25,38 @@ Intelligent Routing (Zuul) and Client Side Load Balancing (Ribbon), Circuit Brea
|
||||
consul:
|
||||
host: localhost
|
||||
port: 8500</pre><p>
|
||||
</p><div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td><th align="left">Caution</th></tr><tr><td align="left" valign="top"><p>If you use <a class="link" href="#spring-cloud-consul-config" title="4. Distributed Configuration with Consul">Spring Cloud Consul Config</a>, the above values will need to be placed in <code class="literal">bootstrap.yml</code> instead of <code class="literal">application.yml</code>.</p></td></tr></table></div><p>The default service name, instance id and port, taken from the <code class="literal">Environment</code>, are <code class="literal">${spring.application.name}</code>, the Spring Context ID and <code class="literal">${server.port}</code> respectively.</p><p>To disable the Consul Discovery Client you can set <code class="literal">spring.cloud.consul.discovery.enabled</code> to <code class="literal">false</code>.</p><p>To disable the service registration you can set <code class="literal">spring.cloud.consul.discovery.register</code> to <code class="literal">false</code>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_http_health_check" href="#_http_health_check"></a>3.3 HTTP Health Check</h2></div></div></div><p>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. <code class="literal">server.servletPath=/foo</code>) or management endpoint path (e.g. <code class="literal">management.server.servlet.context-path=/admin</code>). 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:</p><p><b>application.yml. </b>
|
||||
</p><div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td><th align="left">Caution</th></tr><tr><td align="left" valign="top"><p>If you use <a class="link" href="#spring-cloud-consul-config" title="4. Distributed Configuration with Consul">Spring Cloud Consul Config</a>, the above values will need to be placed in <code class="literal">bootstrap.yml</code> instead of <code class="literal">application.yml</code>.</p></td></tr></table></div><p>The default service name, instance id and port, taken from the <code class="literal">Environment</code>, are <code class="literal">${spring.application.name}</code>, the Spring Context ID and <code class="literal">${server.port}</code> respectively.</p><p>To disable the Consul Discovery Client you can set <code class="literal">spring.cloud.consul.discovery.enabled</code> to <code class="literal">false</code>.</p><p>To disable the service registration you can set <code class="literal">spring.cloud.consul.discovery.register</code> to <code class="literal">false</code>.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_registering_management_as_a_separate_service" href="#_registering_management_as_a_separate_service"></a>3.2.1 Registering Management as a Separate Service</h3></div></div></div><p>When management server port is set to something different than the application port, by setting <code class="literal">management.server.port</code> property, management service will be registered as a separate service than the application service. For example:</p><p><b>application.yml. </b>
|
||||
</p><pre class="screen">spring:
|
||||
application:
|
||||
name: myApp
|
||||
management:
|
||||
server:
|
||||
port: 4452</pre><p>
|
||||
</p><p>Above configuration will register following 2 services:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Application Service:</li></ul></div><pre class="screen">ID: myApp
|
||||
Name: myApp</pre><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Management Service:</li></ul></div><pre class="screen">ID: myApp-management
|
||||
Name: myApp-management</pre><p>Management service will inherit its <code class="literal">instanceId</code> and <code class="literal">serviceName</code> from the application service. For example:</p><p><b>application.yml. </b>
|
||||
</p><pre class="screen">spring:
|
||||
application:
|
||||
name: myApp
|
||||
management:
|
||||
server:
|
||||
port: 4452
|
||||
spring:
|
||||
cloud:
|
||||
consul:
|
||||
discovery:
|
||||
instance-id: custom-service-id
|
||||
serviceName: myprefix-${spring.application.name}</pre><p>
|
||||
</p><p>Above configuration will register following 2 services:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Application Service:</li></ul></div><pre class="screen">ID: custom-service-id
|
||||
Name: myprefix-myApp</pre><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Management Service:</li></ul></div><pre class="screen">ID: custom-service-id-management
|
||||
Name: myprefix-myApp-management</pre><p>Further customization is possible via following properties:</p><pre class="screen">/** 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</pre></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_http_health_check" href="#_http_health_check"></a>3.3 HTTP Health Check</h2></div></div></div><p>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. <code class="literal">server.servletPath=/foo</code>) or management endpoint path (e.g. <code class="literal">management.server.servlet.context-path=/admin</code>). 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:</p><p><b>application.yml. </b>
|
||||
</p><pre class="screen">spring:
|
||||
cloud:
|
||||
consul:
|
||||
|
||||
@@ -69,6 +69,78 @@ public class Application {
|
||||
<simpara>The default service name, instance id and port, taken from the <literal>Environment</literal>, are <literal>${spring.application.name}</literal>, the Spring Context ID and <literal>${server.port}</literal> respectively.</simpara>
|
||||
<simpara>To disable the Consul Discovery Client you can set <literal>spring.cloud.consul.discovery.enabled</literal> to <literal>false</literal>.</simpara>
|
||||
<simpara>To disable the service registration you can set <literal>spring.cloud.consul.discovery.register</literal> to <literal>false</literal>.</simpara>
|
||||
<section xml:id="_registering_management_as_a_separate_service">
|
||||
<title>Registering Management as a Separate Service</title>
|
||||
<simpara>When management server port is set to something different than the application port, by setting <literal>management.server.port</literal> property, management service will be registered as a separate service than the application service. For example:</simpara>
|
||||
<formalpara>
|
||||
<title>application.yml</title>
|
||||
<para>
|
||||
<screen>spring:
|
||||
application:
|
||||
name: myApp
|
||||
management:
|
||||
server:
|
||||
port: 4452</screen>
|
||||
</para>
|
||||
</formalpara>
|
||||
<simpara>Above configuration will register following 2 services:</simpara>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>Application Service:</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<screen>ID: myApp
|
||||
Name: myApp</screen>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>Management Service:</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<screen>ID: myApp-management
|
||||
Name: myApp-management</screen>
|
||||
<simpara>Management service will inherit its <literal>instanceId</literal> and <literal>serviceName</literal> from the application service. For example:</simpara>
|
||||
<formalpara>
|
||||
<title>application.yml</title>
|
||||
<para>
|
||||
<screen>spring:
|
||||
application:
|
||||
name: myApp
|
||||
management:
|
||||
server:
|
||||
port: 4452
|
||||
spring:
|
||||
cloud:
|
||||
consul:
|
||||
discovery:
|
||||
instance-id: custom-service-id
|
||||
serviceName: myprefix-${spring.application.name}</screen>
|
||||
</para>
|
||||
</formalpara>
|
||||
<simpara>Above configuration will register following 2 services:</simpara>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>Application Service:</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<screen>ID: custom-service-id
|
||||
Name: myprefix-myApp</screen>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>Management Service:</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<screen>ID: custom-service-id-management
|
||||
Name: myprefix-myApp-management</screen>
|
||||
<simpara>Further customization is possible via following properties:</simpara>
|
||||
<screen>/** 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</screen>
|
||||
</section>
|
||||
</section>
|
||||
<section xml:id="_http_health_check">
|
||||
<title>HTTP Health Check</title>
|
||||
|
||||
Reference in New Issue
Block a user