[iconverse-admin-0] 2019-02-27 14:22:20.914 WARN 1 --- [nio-8080-exec-8] s.b.a.e.ElasticsearchRestHealthIndicator : Elasticsearch health check failed
[iconverse-admin-0]
[iconverse-admin-0] java.net.ConnectException: Connection refused
[iconverse-admin-0] at org.elasticsearch.client.RestClient$SyncResponseListener.get(RestClient.java:943)
[iconverse-admin-0] at org.elasticsearch.client.RestClient.performRequest(RestClient.java:227)
[iconverse-admin-0] at org.springframework.boot.actuate.elasticsearch.ElasticsearchRestHealthIndicator.doHealthCheck(ElasticsearchRestHealthIndicator.java:61)
[iconverse-admin-0] at org.springframework.boot.actuate.health.AbstractHealthIndicator.health(AbstractHealthIndicator.java:84)
[iconverse-admin-0] at org.springframework.boot.actuate.health.CompositeHealthIndicator.health(CompositeHealthIndicator.java:98)
[iconverse-admin-0] at org.springframework.boot.actuate.health.HealthEndpoint.health(HealthEndpoint.java:50)
[iconverse-admin-0] at org.springframework.boot.actuate.health.HealthEndpointWebExtension.health(HealthEndpointWebExtension.java:54)
[iconverse-admin-0] at jdk.internal.reflect.GeneratedMethodAccessor360.invoke(Unknown Source)
[iconverse-admin-0] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[iconverse-admin-0] at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[iconverse-admin-0] at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:246)
[iconverse-admin-0] at org.springframework.boot.actuate.endpoint.invoke.reflect.ReflectiveOperationInvoker.invoke(ReflectiveOperationInvoker.java:76)
[iconverse-admin-0] at org.springframework.boot.actuate.endpoint.annotation.AbstractDiscoveredOperation.invoke(AbstractDiscoveredOperation.java:61)
[iconverse-admin-0] at org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$ServletWebOperationAdapter.handle(AbstractWebMvcEndpointHandlerMapping.java:294)
[iconverse-admin-0] at org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(AbstractWebMvcEndpointHandlerMapping.java:355)
[iconverse-admin-0] at jdk.internal.reflect.GeneratedMethodAccessor357.invoke(Unknown Source)
[iconverse-admin-0] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[iconverse-admin-0] at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[iconverse-admin-0] at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:189)
[iconverse-admin-0] at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
[iconverse-admin-0] at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
[iconverse-admin-0] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
[iconverse-admin-0] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:800)
[iconverse-admin-0] at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
[iconverse-admin-0] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038)
[iconverse-admin-0] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)
[iconverse-admin-0] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)
[iconverse-admin-0] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897)
[iconverse-admin-0] at javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
[iconverse-admin-0] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)
[iconverse-admin-0] at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
[iconverse-admin-0] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
[iconverse-admin-0] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
[iconverse-admin-0] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
[iconverse-admin-0] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
[iconverse-admin-0] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
[iconverse-admin-0] at com.codahale.metrics.servlet.AbstractInstrumentedFilter.doFilter(AbstractInstrumentedFilter.java:112)
[iconverse-admin-0] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
[iconverse-admin-0] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
[iconverse-admin-0] at org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:90)
[iconverse-admin-0] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
[iconverse-admin-0] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
[iconverse-admin-0] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
[iconverse-admin-0] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
[iconverse-admin-0] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
[iconverse-admin-0] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
[iconverse-admin-0] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
[iconverse-admin-0] at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
[iconverse-admin-0] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
[iconverse-admin-0] at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
[iconverse-admin-0] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
[iconverse-admin-0] at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
[iconverse-admin-0] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
[iconverse-admin-0] at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
[iconverse-admin-0] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
[iconverse-admin-0] at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
[iconverse-admin-0] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
[iconverse-admin-0] at com.taiger.admin.security.jwt.JWTFilter.doFilter(JWTFilter.java:43)
[iconverse-admin-0] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
[iconverse-admin-0] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:121)
[iconverse-admin-0] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
[iconverse-admin-0] at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66)
[iconverse-admin-0] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
[iconverse-admin-0] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
[iconverse-admin-0] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
[iconverse-admin-0] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
[iconverse-admin-0] at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
[iconverse-admin-0] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
[iconverse-admin-0] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
[iconverse-admin-0] at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)
[iconverse-admin-0] at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)
[iconverse-admin-0] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357)
[iconverse-admin-0] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)
[iconverse-admin-0] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
[iconverse-admin-0] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
[iconverse-admin-0] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
[iconverse-admin-0] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
[iconverse-admin-0] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
[iconverse-admin-0] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
[iconverse-admin-0] at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92)
[iconverse-admin-0] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
[iconverse-admin-0] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
[iconverse-admin-0] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
[iconverse-admin-0] at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
[iconverse-admin-0] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
[iconverse-admin-0] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
[iconverse-admin-0] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
[iconverse-admin-0] at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:130)
[iconverse-admin-0] at org.springframework.boot.web.servlet.support.ErrorPageFilter.access$000(ErrorPageFilter.java:66)
[iconverse-admin-0] at org.springframework.boot.web.servlet.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:105)
[iconverse-admin-0] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
[iconverse-admin-0] at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:123)
[iconverse-admin-0] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
[iconverse-admin-0] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
[iconverse-admin-0] at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:117)
[iconverse-admin-0] at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:106)
[iconverse-admin-0] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
[iconverse-admin-0] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
[iconverse-admin-0] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
[iconverse-admin-0] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
[iconverse-admin-0] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
[iconverse-admin-0] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
[iconverse-admin-0] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
[iconverse-admin-0] at com.taiger.admin.web.filter.SimpleCORSFilter.doFilter(SimpleCORSFilter.java:53)
[iconverse-admin-0] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
[iconverse-admin-0] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
[iconverse-admin-0] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200)
[iconverse-admin-0] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
[iconverse-admin-0] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
[iconverse-admin-0] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
[iconverse-admin-0] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
[iconverse-admin-0] at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:668)
[iconverse-admin-0] at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:679)
[iconverse-admin-0] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
[iconverse-admin-0] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
[iconverse-admin-0] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
[iconverse-admin-0] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
[iconverse-admin-0] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834)
[iconverse-admin-0] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415)
[iconverse-admin-0] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
[iconverse-admin-0] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[iconverse-admin-0] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[iconverse-admin-0] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
[iconverse-admin-0] at java.base/java.lang.Thread.run(Thread.java:834)
[iconverse-admin-0] Caused by: java.net.ConnectException: Connection refused
[iconverse-admin-0] at java.base/sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
[iconverse-admin-0] at java.base/sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:779)
[iconverse-admin-0] at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvent(DefaultConnectingIOReactor.java:171)
[iconverse-admin-0] at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:145)
[iconverse-admin-0] at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:348)
[iconverse-admin-0] at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.execute(PoolingNHttpClientConnectionManager.java:221)
[iconverse-admin-0] at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase$1.run(CloseableHttpAsyncClientBase.java:64)
[iconverse-admin-0] ... 1 common frames omitted
[spring-projects/spring-boot]2.1.2.RELEASE ElasticSearch 6.6.0执行器ElasticsearchRestHealthIndicator返回连接被拒绝
回答
这看起来很像#16007。您如何配置 Elasticsearch 客户端将连接的节点?
我将 AWS ALB 目标组定期运行状况检查配置为 /myapp/actuator/health ,然后级联到 Elasticsearch,但失败了。
感谢您的回复。不幸的是,这并没有回答我试图问的问题。
您的应用程序使用 Elasticsearch 的情况如何?您如何配置用于连接到 Elasticsearch 节点的客户端?从堆栈跟踪中,我可以看出有一个org.elasticsearch.client.RestClient
bean 配置了不接受连接的主机和端口。这告诉我有些东西配置错误,但我无法仅从堆栈跟踪中判断出什么。
我使用这些 Maven 依赖项:
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>6.6.0</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>6.6.0</version>
</dependency>
我的应用程序访问 Elasticsearch 完全没有问题。我不知道为什么 /health 端点失败。它不是编程方式,而是来自 AWS ALB 的 HTTP 调用。我没有为 ES healthcheck 端点配置任何内容。
当我配置 management.elasticsearch.enabled = false 时,一切正常。然而,让执行器检查 ES 是件好事,因为它是我的应用程序的关键组件。
您如何配置它来访问 Elasticsearch?您是否使用spring.data.elasticsearch.cluster-nodes
属性或定义自己的客户端 bean 来配置它?
我的 application.yml 中有这个:
data:
elasticsearch:
cluster-name:
cluster-nodes: localhost:9300
我修复了这个问题,svc-elasticsearch:9300
但没有效果。在我的 ES pod 中,我得到的是:
$ k exec -it iconverse-elasticsearch-0 -- bash
root@iconverse-elasticsearch-0:/# curl svc-elasticsearch:9300
This is not an HTTP portroot@iconverse-elasticsearch-0:/#
root@iconverse-elasticsearch-0:/#
您的应用程序中的 bean似乎RestClient
没有获取 application.yml 中的配置。如果curl正在接收,This is not an HTTP port
那么它正在管理连接,但svc-elasticsearch:9300
正在使用Elasticsearch的TCP传输。运行状况指示器RestClient
使用的连接尝试被拒绝,因此它不能使用相同的主机名和端口。
您共享的 YAML 是否被截断?它应该有一个spring:
密钥:
spring:
data:
elasticsearch:
cluster-name:
cluster-nodes: svc-elasticsearch:9300
该配置应该会产生一个RestClient
将连接到的 bean,svc-elasticsearch:9300
除非您定义了自己的RestClient
bean,在这种情况下,自动配置RestClient
将退出。状态评估报告可从执行器获取或在启动时记录(当您使用 启动时)--debug
,该报告将向您显示那里发生的情况。
如果不涉及用户配置的 bean 并且您仅依赖于自动配置,那么我们需要做更多的事情来确定为什么自动配置RestClient
显然没有使用正确的主机和/或端口进行连接到 Elasticsearch。一种方法是使用调试器并验证正在RestClient
使用的设置。如果您希望我们尝试为您进行此诊断,我们将需要一个完整且最小的应用程序来重现您所描述的行为。
该运行状况端点应使用哪个端口? 9200还是9300?
是的,我的 YAML 是正确的。它是以下元素的子元素spring
使用HealthIndicator
aRestClient
来检查 Elasticsearch 的运行状况。它应该使用 HTTP 端口,默认为 9200。
如果您希望我们继续花时间帮助您,请花时间提供我在上面要求的信息:
只需 grep 源代码即可。是的,我们创建了一个@Service:
@Service
public class ESService {
@Value("${iconverse.elasticsearch.host}")
private String elasticsearchHost;
@Value("${iconverse.elasticsearch.port}")
private int elasticsearchPort;
@PostConstruct
public void init() throws UnknownHostException, NodeValidationException {
client = new RestHighLevelClient(
RestClient.builder(new HttpHost(elasticsearchHost, elasticsearchPort, HttpHost.DEFAULT_SCHEME_NAME)));
}
}
谢谢。在那里创建的客户端不会作为 bean 公开,因此运行状况指示器不会使用它。相反,健康指示器将使用自动配置的 RestClient。我相信,这就是为什么健康指示器无法连接但您自己的应用程序代码可以连接的原因。
您可能希望使用您的和属性来定义您自己的RestClient
bean ,并将其注入到您的服务中。这将导致自动配置的 bean 退出。 iconverse.elasticsearch.host
iconverse.elasticsearch.port
或者,您可能希望删除自己的创建RestClient
并注入自动配置的创建。在这种情况下,您需要更新属性spring.data.elasticsearch.cluster-nodes
以使用手动创建的客户端当前正在使用的主机和端口。
我现在非常确定这是一个配置问题,因此我将关闭此问题。正如贡献指南中提到的,我们更喜欢仅使用 GitHub 问题来解决错误和增强功能。希望以上内容能为您提供工作所需的帮助。如果没有,请关注 Gitter 或 Stack Overflow。
如何注入自动配置的restclient?
我有这个@Configuration bean:
@Configuration
public class ElasticSearchConfiguration {
@Value("${iconverse.elasticsearch.host}")
private String elasticsearchHost;
@Value("${iconverse.elasticsearch.port}")
private int elasticsearchPort;
@Bean
public RestHighLevelClient restHighLevelClient() {
return new RestHighLevelClient(RestClient.builder(new HttpHost(elasticsearchHost, elasticsearchPort, HttpHost.DEFAULT_SCHEME_NAME)));
}
}
并在我的@Service 中@Autowired:
@Autowired
private RestHighLevelClient client;
但无济于事。异常仍然存在。
您已将 a 暴露RestHighLevelClient
为 bean。运行状况指示器需要 a RestClient
,因此这就是需要作为 bean 公开的内容。 Boot 的自动配置通过将 公开RestClientBuilder
为 bean,然后使用它来创建RestClient
和 RestHighLevelClient
beans 来实现这一点。
不幸的是,我没有更多的时间来处理这个问题,所以我无法再次回应这个问题。如果您需要进一步的指导,请遵守我们的贡献指南并在 Stack Overflow 或 Gitter 上进行跟进。
@khteh Healthcheck 默认启用。 Elasticsearch 检查是自动配置的。但此验证是通过 Elasticsearch Rest Client API 执行的,您必须覆盖属性 spring.elasticsearch.rest.uris
spring.elasticsearch.rest.uris=your-host:9200