SpringDataElasticsearch解决5,000 milliseconds timeout on connection http-outgoing-8237946 [ACTIVE]

这篇具有很好参考价值的文章主要介绍了SpringDataElasticsearch解决5,000 milliseconds timeout on connection http-outgoing-8237946 [ACTIVE]。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

问题描述

es数据库中接近1千万数据,在列表请求时报错,信息如下:

org.springframework.dao.DataAccessResourceFailureException: 5,000 milliseconds timeout on connection http-outgoing-8237946 [ACTIVE]; nested exception is java.lang.RuntimeException: 5,000 milliseconds timeout on connection http-outgoing-8237946 [ACTIVE]
        at org.springframework.data.elasticsearch.core.ElasticsearchExceptionTranslator.translateExceptionIfPossible(ElasticsearchExceptionTranslator.java:75) ~[spring-data-elasticsearch-4.2.6.jar!/:4.2.6]
        at org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate.translateException(ElasticsearchRestTemplate.java:402) ~[spring-data-elasticsearch-4.2.6.jar!/:4.2.6]
        at org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate.execute(ElasticsearchRestTemplate.java:385) ~[spring-data-elasticsearch-4.2.6.jar!/:4.2.6]
        at org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate.search(ElasticsearchRestTemplate.java:296) ~[spring-data-elasticsearch-4.2.6.jar!/:4.2.6]
        at org.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate.search(AbstractElasticsearchTemplate.java:513) ~[spring-data-elasticsearch-4.2.6.jar!/:4.2.6]
        at com.cxstar.business.service.impl.JournalPaperServiceImpl.getJournalPaperList(JournalPaperServiceImpl.java:159) ~[cxstar-business-1.0.0.jar!/:1.0.0]
        at com.cxstar.api.business.controller.paper.JournalPaperController.list(JournalPaperController.java:50) ~[classes!/:1.0.0]
        at com.cxstar.api.business.controller.paper.JournalPaperController$$FastClassBySpringCGLIB$$d2cc2765.invoke(<generated>) ~[classes!/:1.0.0]
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.3.12.jar!/:5.3.12]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:783) ~[spring-aop-5.3.12.jar!/:5.3.12]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.3.12.jar!/:5.3.12]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753) ~[spring-aop-5.3.12.jar!/:5.3.12]
        at org.springframework.validation.beanvalidation.MethodValidationInterceptor.invoke(MethodValidationInterceptor.java:123) ~[spring-context-5.3.12.jar!/:5.3.12]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.12.jar!/:5.3.12]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753) ~[spring-aop-5.3.12.jar!/:5.3.12]
        at org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:61) ~[spring-security-core-5.5.3.jar!/:5.5.3]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.12.jar!/:5.3.12]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753) ~[spring-aop-5.3.12.jar!/:5.3.12]
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:698) ~[spring-aop-5.3.12.jar!/:5.3.12]
        at com.cxstar.api.business.controller.paper.JournalPaperController$$EnhancerBySpringCGLIB$$1d15850b.list(<generated>) ~[classes!/:1.0.0]
        at sun.reflect.GeneratedMethodAccessor1162.invoke(Unknown Source) ~[na:na]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_73]
        at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_73]
        at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-5.3.12.jar!/:5.3.12]
        at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150) ~[spring-web-5.3.12.jar!/:5.3.12]
        at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117) ~[spring-webmvc-5.3.12.jar!/:5.3.12]
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) ~[spring-webmvc-5.3.12.jar!/:5.3.12]
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) ~[spring-webmvc-5.3.12.jar!/:5.3.12]
        at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.3.12.jar!/:5.3.12]
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1067) ~[spring-webmvc-5.3.12.jar!/:5.3.12]
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963) ~[spring-webmvc-5.3.12.jar!/:5.3.12]
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.12.jar!/:5.3.12]
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) ~[spring-webmvc-5.3.12.jar!/:5.3.12]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:523) [jboss-servlet-api_4.0_spec-2.0.0.Final.jar!/:2.0.0.Final]
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.12.jar!/:5.3.12]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:590) [jboss-servlet-api_4.0_spec-2.0.0.Final.jar!/:2.0.0.Final]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) [tomcat-embed-websocket-9.0.54.jar!/:na]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:113) [spring-web-5.3.12.jar!/:5.3.12]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:113) [spring-web-5.3.12.jar!/:5.3.12]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:113) [spring-web-5.3.12.jar!/:5.3.12]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.54.jar!/:na]
        at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:124) [druid-1.2.8.jar!/:1.2.8]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.54.jar!/:na]
        at com.cxstar.common.filter.RepeatableFilter.doFilter(RepeatableFilter.java:35) [cxstar-common-1.0.0.jar!/:1.0.0]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327) [spring-security-web-5.5.3.jar!/:5.5.3]
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115) [spring-security-web-5.5.3.jar!/:5.5.3]
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81) [spring-security-web-5.5.3.jar!/:5.5.3]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) [spring-security-web-5.5.3.jar!/:5.5.3]
        at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:121) [spring-security-web-5.5.3.jar!/:5.5.3]
        at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115) [spring-security-web-5.5.3.jar!/:5.5.3]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) [spring-security-web-5.5.3.jar!/:5.5.3]
        at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126) [spring-security-web-5.5.3.jar!/:5.5.3]
        at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81) [spring-security-web-5.5.3.jar!/:5.5.3]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) [spring-security-web-5.5.3.jar!/:5.5.3]
        at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:105) [spring-security-web-5.5.3.jar!/:5.5.3]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) [spring-security-web-5.5.3.jar!/:5.5.3]
        at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149) [spring-security-web-5.5.3.jar!/:5.5.3]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) [spring-security-web-5.5.3.jar!/:5.5.3]
        at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) [spring-security-web-5.5.3.jar!/:5.5.3]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) [spring-security-web-5.5.3.jar!/:5.5.3]
        at com.cxstar.framework.security.filter.JwtAuthenticationTokenFilter.doFilterInternal(JwtAuthenticationTokenFilter.java:63) [cxstar-framework-1.0.0.jar!/:1.0.0]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) [spring-web-5.3.12.jar!/:5.3.12]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) [spring-security-web-5.5.3.jar!/:5.5.3]
        at com.cxstar.framework.iparea.filter.IpAreaVisitFilter.doFilterInternal(IpAreaVisitFilter.java:116) [cxstar-framework-1.0.0.jar!/:1.0.0]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) [spring-web-5.3.12.jar!/:5.3.12]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) [spring-security-web-5.5.3.jar!/:5.5.3]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:113) [spring-web-5.3.12.jar!/:5.3.12]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) [spring-security-web-5.5.3.jar!/:5.5.3]
        at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103) [spring-security-web-5.5.3.jar!/:5.5.3]
        at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89) [spring-security-web-5.5.3.jar!/:5.5.3]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) [spring-security-web-5.5.3.jar!/:5.5.3]
        at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91) [spring-web-5.3.12.jar!/:5.3.12]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) [spring-web-5.3.12.jar!/:5.3.12]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) [spring-security-web-5.5.3.jar!/:5.5.3]
        at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) [spring-security-web-5.5.3.jar!/:5.5.3]
        at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) [spring-security-web-5.5.3.jar!/:5.5.3]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) [spring-web-5.3.12.jar!/:5.3.12]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) [spring-security-web-5.5.3.jar!/:5.5.3]
        at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110) [spring-security-web-5.5.3.jar!/:5.5.3]
        at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) [spring-security-web-5.5.3.jar!/:5.5.3]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) [spring-security-web-5.5.3.jar!/:5.5.3]
        at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55) [spring-security-web-5.5.3.jar!/:5.5.3]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) [spring-web-5.3.12.jar!/:5.3.12]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) [spring-security-web-5.5.3.jar!/:5.5.3]
        at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211) [spring-security-web-5.5.3.jar!/:5.5.3]
        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) [spring-security-web-5.5.3.jar!/:5.5.3]
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) [spring-web-5.3.12.jar!/:5.3.12]
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) [spring-web-5.3.12.jar!/:5.3.12]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) [spring-web-5.3.12.jar!/:5.3.12]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) [spring-web-5.3.12.jar!/:5.3.12]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) [spring-web-5.3.12.jar!/:5.3.12]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) [spring-web-5.3.12.jar!/:5.3.12]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) [spring-web-5.3.12.jar!/:5.3.12]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) [spring-web-5.3.12.jar!/:5.3.12]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:895) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1722) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) [tomcat-embed-core-9.0.54.jar!/:na]
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.54.jar!/:na]
        at java.lang.Thread.run(Thread.java:745) [na:1.8.0_73]
Caused by: java.lang.RuntimeException: 5,000 milliseconds timeout on connection http-outgoing-8237946 [ACTIVE]
        at org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate.translateException(ElasticsearchRestTemplate.java:400) ~[spring-data-elasticsearch-4.2.6.jar!/:4.2.6]
        ... 128 common frames omitted
Caused by: java.net.SocketTimeoutException: 5,000 milliseconds timeout on connection http-outgoing-8237946 [ACTIVE]
        at org.elasticsearch.client.RestClient.extractAndWrapCause(RestClient.java:865) ~[elasticsearch-rest-client-7.12.1.jar!/:7.12.1]
        at org.elasticsearch.client.RestClient.performRequest(RestClient.java:283) ~[elasticsearch-rest-client-7.12.1.jar!/:7.12.1]
        at org.elasticsearch.client.RestClient.performRequest(RestClient.java:270) ~[elasticsearch-rest-client-7.12.1.jar!/:7.12.1]
        at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1654) ~[elasticsearch-rest-high-level-client-7.12.1.jar!/:7.12.1]
        at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1624) ~[elasticsearch-rest-high-level-client-7.12.1.jar!/:7.12.1]
        at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1594) ~[elasticsearch-rest-high-level-client-7.12.1.jar!/:7.12.1]
        at org.elasticsearch.client.RestHighLevelClient.search(RestHighLevelClient.java:1110) ~[elasticsearch-rest-high-level-client-7.12.1.jar!/:7.12.1]
        at org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate.lambda$search$11(ElasticsearchRestTemplate.java:296) ~[spring-data-elasticsearch-4.2.6.jar!/:4.2.6]
        at org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate.execute(ElasticsearchRestTemplate.java:383) ~[spring-data-elasticsearch-4.2.6.jar!/:4.2.6]
        ... 127 common frames omitted
Caused by: java.net.SocketTimeoutException: 5,000 milliseconds timeout on connection http-outgoing-8237946 [ACTIVE]
        at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.timeout(HttpAsyncRequestExecutor.java:387) ~[httpcore-nio-4.4.14.jar!/:4.4.14]
        at org.apache.http.impl.nio.client.InternalIODispatch.onTimeout(InternalIODispatch.java:92) ~[httpasyncclient-4.1.4.jar!/:4.1.4]
        at org.apache.http.impl.nio.client.InternalIODispatch.onTimeout(InternalIODispatch.java:39) ~[httpasyncclient-4.1.4.jar!/:4.1.4]
        at org.apache.http.impl.nio.reactor.AbstractIODispatch.timeout(AbstractIODispatch.java:175) ~[httpcore-nio-4.4.14.jar!/:4.4.14]
        at org.apache.http.impl.nio.reactor.BaseIOReactor.sessionTimedOut(BaseIOReactor.java:261) ~[httpcore-nio-4.4.14.jar!/:4.4.14]
        at org.apache.http.impl.nio.reactor.AbstractIOReactor.timeoutCheck(AbstractIOReactor.java:502) ~[httpcore-nio-4.4.14.jar!/:4.4.14]
        at org.apache.http.impl.nio.reactor.BaseIOReactor.validate(BaseIOReactor.java:211) ~[httpcore-nio-4.4.14.jar!/:4.4.14]
        at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:280) ~[httpcore-nio-4.4.14.jar!/:4.4.14]
        at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104) ~[httpcore-nio-4.4.14.jar!/:4.4.14]
        at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:591) ~[httpcore-nio-4.4.14.jar!/:4.4.14]
        ... 1 common frames omitted

问题分析:

问题的关键在于:SocketTimeoutException,直接查询es数据库发现耗时近10s,因此可以判断是程序的问题

问题解决:

在es的配置类中增加设置socket超时时间 .withSocketTimeout(socketTimeout)文章来源地址https://www.toymoban.com/news/detail-517394.html

package com.cxstar.business.config;

import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.elasticsearch.client.ClientConfiguration;
import org.springframework.data.elasticsearch.client.RestClients;


@Configuration
public class EsConfig {

    @Value("${spring.elasticsearch.rest.uris}")
    private String uris;

    @Value("${spring.elasticsearch.rest.socket-timeout}")
    private long socketTimeout;

    @Bean(destroyMethod = "close")
    public RestHighLevelClient restClient() {

        ClientConfiguration clientConfiguration = ClientConfiguration.builder()
                .connectedTo(uris.replace("http://", ""))
                .withSocketTimeout(socketTimeout)
                .build();

        RestHighLevelClient client = RestClients.create(clientConfiguration).rest();
        return client;
    }
}

到了这里,关于SpringDataElasticsearch解决5,000 milliseconds timeout on connection http-outgoing-8237946 [ACTIVE]的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • mysql出现ERROR 2003 (HY000): Can‘t connect to MySQL server on ‘localhost‘ (10061)的解决方法

    当你想通过命令窗口想打开mysql时候发现提示ERROR 2003 (HY000): Can\\\'t connect to MySQL server on \\\'localhost\\\' (10061)。感觉特别的苦恼,我也是,因此发出此教程带你 三步 解决该问题。 这句话的意思是:错误2003 (HY000):无法连接到MySQL服务器在\\\'localhost\\\' (10061) 。  第一步: 我们只需要输入s

    2024年02月16日
    浏览(43)
  • MYSQL登录遇到的问题:解决ERROR 2003 (HY000): Can‘t connect to MySQL server on ‘localhost:3306‘(10061)

    重新捡起mysql,在配置时出现了这样的问题 在登陆时输入mysql -uroot -p进行登陆时发现如下错误 解决方法: 第一步:在该窗口继续输入mysqld --console出现如下窗口: 然后重新在cmd中打开上面窗口,即第二个窗口(注意用管理员权限打开上述窗口,且第一个窗口不能关闭) 按下

    2024年02月11日
    浏览(54)
  • ERROR 2003 (HY000): Can‘t connect to MySQL server on ‘localhost:3306‘ (10061)

    windows安装的MySQL(mysql-8.0.29-winx64)数据库长时间没有使用,今天用 Navicat 连接时,突然就连不上了 ,报错 ERROR 2003 (HY000): Can’t connect to MySQL server on ‘localhost:3306’ (10061) , 这里记录一下解决过程。 1、首先排查MYSQL 服务是否开启, Ctrl + Alt + Delete 打开任务管理器, 搜索 M

    2024年02月19日
    浏览(58)
  • MySQL远程连接报错:ERROR 2002 (HY000): Can‘t connect to server on ‘192.168.172.130‘ (115)

    目录 1、程序报错:(不能远程连接数据库) 2、测试是否能ping到远程机器 3、登录数据库 4、仍无法连接到数据库,可能不能访问端口号,再次测试(端口telnet 不通) 5、MySQL远程登录连接成功 6、如果上面方法还是没有解决。直接kill进程,重启。 1、 程序报错:(不能远程

    2024年02月07日
    浏览(51)
  • ModbusRTU err:connection timeout解决办法

    ModbusRTU err:connection timeout解决办法 一般遇到问题不要慌 检查以下几条帮你轻松解决: 1、确保链路畅通(也就是串口收发数据是否正常) 2、排查是否硬件有问题 3、程序是否有问题 如若出现下面问题,请查看超时时间是否设置正确 这种问题出现的原因: 其一是因为串口断开

    2024年02月16日
    浏览(40)
  • 解决CondaHTTPError HTTP 000 CONNECTION FAILED for url解决方法

    问题: 使用conda install 命令安装包提示 CondaHTTPError: HTTP 000 CONNECTION FAILED for url 分析:网络连接问题,大概率是网速不行或者源没有换 解决方案: 修改国内源 (国内源已修改或许是因为网速波动,此时可以延长下载时间) 找到 .condarc 文件 文件内容替换为: 如果前两步替换

    2024年02月10日
    浏览(41)
  • 解决windows下报错CondaHTTPError: HTTP 000 CONNECTION FAILED问题

    conda环境突然崩掉了,重新配置了系统环境变量后conda环境正常,但是在创建新的虚拟环境后报错 问题很清楚,就是镜像源的问题,但是查找了一些解决方法都无效,包括根据清华提供的更换源的方法,最后按照这个方法解决后,记录一下。 首先,创建condarc文件,Windows 用户

    2024年02月15日
    浏览(42)
  • 报错解决: CondaHTTPError: HTTP 000 CONNECTION FAILED for url ***

    问题描述 在我设置好国内源之后,用conda创建虚拟环境,下载python版本时出现以下错误。 Solving environment: failed CondaHTTPError: HTTP 000 CONNECTION FAILED for url https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarch/repodata.json Elapsed: - An HTTP error occurred when trying to retrieve this URL. HTTP errors are of

    2024年02月16日
    浏览(46)
  • 解决git针对github项目出现443connection timeout的异常

    目前用到了github上的一些开源项目,本地在通过idea clone(提交)代码的时候经常会出现443 connection timeout的异常(如下): 网上看了很多方法,都没有彻底解决,现总结方法如下: v2ray(或其他vpn)开启,默认是绕过大陆路由模式; git添加以下参数(其中本地proxy端口需要根据

    2024年01月25日
    浏览(45)
  • CondaHTTPError: HTTP 000 CONNECTION FAILED for url解决方法(不用换源,简单有效)

    安装pytorch 的过程中出了一些问题, 提示 CondaHTTPError: HTTP 000 CONNECTION FAILED for url 换源之后也是一样的问题。 应该是网速的原因,但是不管重复多少次都是失败。 最后终于找到了方法,因为下载时间过长,会自动断开,就会提示连接失败,设置延时1000s,如果还是不行的话就

    2024年02月16日
    浏览(39)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包