SpringBoot 2.7.17迁移后Elasticsearch节点嗅探超时问题求助
问题
将项目从SpringBoot 2.4.0迁移至2.7.17,使用Java 11和Elasticsearch 7.10.1版本。项目启动后运行正常,能创建数据库并插入所有数据,但运行4-5分钟后出现以下错误:
org.elasticsearch.client.sniff.Sniffer$Task: error while sniffing nodes - java.net.ConnectException: Timeout connecting to [/172.17.0.2:9200]
经Docker查看,172.17.0.2是Elasticsearch容器的IP地址。报错后项目仍继续运行,且后端Elasticsearch功能似乎正常。
相关配置文件
application.yaml
setup: admin-account: "..." security: jwt: validity-minutes: 60 elastic: reindex: cron: "0 0 3 * * ?" spring: jpa: hibernate: ddl-auto: validate properties: hibernate: search: schema_management: strategy: drop-and-create-and-drop backend: hosts: localhost:9200 protocol: http liquibase: change-log: classpath:db/changelog/db.changelog-master.yaml enabled: true contexts: test_1 servlet: multipart: max-file-size: 10MB max-request-size: 10MB logging: level: de.bbht: WARN org: springframework: security: WARN config: "./config/logback.xml" springdoc: api-docs: enabled: true swagger-ui: operations-sorter: "method" server: error: include-message: always
application-local.yaml
cors: allowed-origins: - "http://localhost:8080" - "http://localhost:4200" security: jwt: secret: ... spring: datasource: url: jdbc:postgresql://localhost:5432/postgres?useSSL=false username: postgres password: liquibase: change-log: classpath:db/changelog/db.changelog-master.yaml enabled: true jpa: database-platform: org.hibernate.dialect.PostgreSQL9Dialect mail: host: smtp.gmail.com port: 587 username: "..." password: "..." properties: mail: smtp: auth: true starttls: enable: true logging: level: de.bbht: DEBUG org: docx4j: model: datastorage: DEBUG springframework: security: DEBUG
已尝试的解决方案
- 升级Elasticsearch镜像至7.17.3,问题依旧存在
- 在application.yaml中添加以下配置,无效:
spring: data: elasticsearch: cluster-name: elasticsearch cluster-nodes: localhost:9200 repositories: enabled: true
内容的提问来源于stack exchange,提问作者Sistem Suciu
相关产品推荐
相关产品推荐

