Elasticsearch + Springboot 启动报错 java.net.ConnectException: Connection refused

2019-08-15 15:31:02.536 DEBUG 8890 --- [on(4)-127.0.0.1] o.a.http.impl.nio.client.MainClientExec  : [exchange: 1] start execution
2019-08-15 15:31:02.541 DEBUG 8890 --- [on(4)-127.0.0.1] o.a.h.client.protocol.RequestAddCookies  : CookieSpec selected: default
2019-08-15 15:31:02.550 DEBUG 8890 --- [on(4)-127.0.0.1] o.a.h.client.protocol.RequestAuthCache   : Re-using cached 'basic' auth scheme for http://localhost:9200
2019-08-15 15:31:02.550 DEBUG 8890 --- [on(4)-127.0.0.1] o.a.h.client.protocol.RequestAuthCache   : No credentials for preemptive authentication
2019-08-15 15:31:02.550 DEBUG 8890 --- [on(4)-127.0.0.1] o.a.h.i.n.c.InternalHttpAsyncClient      : [exchange: 1] Request connection for {}->http://localhost:9200
2019-08-15 15:31:02.552 DEBUG 8890 --- [on(4)-127.0.0.1] .n.c.PoolingNHttpClientConnectionManager : Connection request: [route: {}->http://localhost:9200][total kept alive: 0; route allocated: 0 of 10; total allocated: 0 of 30]
2019-08-15 15:31:02.556 DEBUG 8890 --- [pool-2-thread-1] .n.c.PoolingNHttpClientConnectionManager : Connection request failed

java.net.ConnectException: Connection refused
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
    at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvent(DefaultConnectingIOReactor.java:171)
    at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:145)
    at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:348)
    at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.execute(PoolingNHttpClientConnectionManager.java:221)
    at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase$1.run(CloseableHttpAsyncClientBase.java:64)
    at java.lang.Thread.run(Thread.java:748)

 

这个错误应该是 在spring boot 启动时 检查了一下 es的健康状态 然后请求走的是 9200端口 

我的es 安装在服务器上了 没有安装到本地

之所以报错  localhost:9200 拒绝很正常 因为本地就没有 

解决方法:

      

spring:
    elasticsearch:
        rest:
          uris: ["http://192.168.10.68:9200"]

但是好像需要什么插件吧 好像是 head  我没有用这种方法解决 比较懒 没有再去安装插件 

直接用简单暴力方法解决

management.health.elasticsearch.enabled=false

直接就是不去检查  (这种还是不推荐的)

 

转载于:https://www.cnblogs.com/pqy521/p/11358340.html

评论将由博主筛选后显示,对所有人可见 | 还能输入1000个字符 “速评一下”
©️2020 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页