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"]


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM