Timeout connecting to [localhost/127.0.0.1:9200]

空服务启动时(或者压根没引入es相关jar包)报Timeout connecting to [localhost/127.0.0.1:9200]错误时,查看pom.xml中是否引用了

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

该组件是sprongboot核心组件之一,里面默认集成了es,会进行es健康检查

1.取消对es健康检查在management:标签中添加

management:
  health:
    elasticsearch:
      enabled: false

2.配置自己可以正常连接的es地址,去替换默认127.0.0.1:9200地址

spring.elasticsearch.rest.uris=["xxxx:9200"]

posted @ 2022-01-11 13:45  不爱喝可乐的吕布  阅读(4251)  评论(0编辑  收藏  举报