【发布时间】:2018-11-26 19:46:29
【问题描述】:
我正在使用 jhipster 生成的应用程序和 MySQL 数据库。我的应用程序在 Ubuntu 18.04 上使用 nginx 部署在 tomcat 上(使用 mvnw 包 -Pprod 生成的 .war 文件)。为了部署,我使用了 .war.orig 文件。
在 Ubuntu 服务器上,我安装了 elasticsearch,就像这里的指南中描述的那样(我使用的是 elasticsearch 6.3 版):https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-elasticsearch-on-ubuntu-16-04
而 /etc/elasticsearch/elasticsearch.yml 文件如下所示:
network.host: localhost
http.port: 9200
在 application-prod.yml 我有以下 elasticsearch 配置:
data:
elasticsearch:
cluster-name:
cluster-nodes: localhost:9200
当我在 tomcat 上部署应用时出现以下错误:
2018-06-17 22:58:49.675 ERROR 28733 --- [1-8080-exec-161] o.z.p.spring.web.advice.AdviceTrait : Internal Server Error
org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [{#transport#-1}{localhost}{127.0.0.1:9300}]
应用程序正在运行,但对后端的每个请求(登录除外)都会导致内部服务器错误 500。
curl -X GET 'http://localhost:9200' 命令给出了正确的返回值。
我是否配置错误?
【问题讨论】:
-
你使用的是什么版本的 JHipster?要使用的正确 Elasticsearch 版本取决于 spring-data-elasticsearch 库。在 JHipster v4 中,它是 2.x
标签: java spring spring-boot elasticsearch jhipster