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:
|
||||
|
||||
Reference in New Issue
Block a user