该项目由jhipster5.1.0生成。我正在Docker上运行ElasticSearch,可在本地使用
$ curl http://192.168.99.100:9200
{
"name" : "2ppRsDa",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "zX-bjYZaT8Ciy7uwwgOl7A",
"version" : {
"number" : "5.6.5",
"build_hash" : "6a37571",
"build_date" : "2017-12-04T07:50:10.466Z",
"build_snapshot" : false,
"lucene_version" : "6.6.1"
},
"tagline" : "You Know, for Search"
}
elasticsearch.yml 是
version: '2'
services:
site-elasticsearch:
image: elasticsearch:5.6.5
# volumes:
# - ~/volumes/jhipster/site/elasticsearch/:/usr/share/elasticsearch/data/
ports:
- 9200:9200
- 9300:9300
command: -Enetwork.host=0.0.0.0 -Ediscovery.type=single-node
environment:
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
然后我运行docker-compose -f src/main/docker/elasticsearch.yml up -d
来运行elasticsearch
关于elasticsearch的 application-dev.yml 就是这样
spring:
data:
elasticsearch:
cluster-name:
cluster-nodes: 192.168.99.100:9300
properties:
path:
logs: target/elasticsearch/log
data: target/elasticsearch/data
我更改群集节点的ipAddress,例如localhost:9300
192.168.99.100:9200
localhost:9200
,其他仍然无效的情况,
ERROR 23900 --- [ restartedMain] .d.e.r.s.AbstractElasticsearchRepository : failed to load elasticsearch nodes : org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [{#transport#-1}{F_hsW-grSnaDZP5t2KwHLg}{192.168.99.100}{192.168.99.100:9300}]
ERROR 23900 --- [ restartedMain] .d.e.r.s.AbstractElasticsearchRepository : failed to load elasticsearch nodes : org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [{#transport#-1}{F_hsW-grSnaDZP5t2KwHLg}{192.168.99.100}{192.168.99.100:9300}]
我在Win10上运行项目,而docker是
Client:
Version: 18.03.0-ce
API version: 1.37
Go version: go1.9.4
Git commit: 0520e24302
Built: Fri Mar 23 08:31:36 2018
OS/Arch: windows/amd64
Experimental: false
Orchestrator: swarm
Server:
Engine:
Version: 18.05.0-ce
API version: 1.37 (minimum version 1.12)
Go version: go1.10.1
Git commit: f150324
Built: Wed May 9 22:20:42 2018
OS/Arch: linux/amd64
Experimental: false
docker-compose版本为
docker-compose version 1.20.1, build 5d8c71b2
docker-py version: 3.1.4
CPython version: 3.6.4
OpenSSL version: OpenSSL 1.0.2k 26 Jan 2017
docker容器的运行状态:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
NAMES
0b3f330ca44e elasticsearch:5.6.5 "/docker-entrypoint.…" About an hour ago Up About an hour 0.0.0.0:9200->9200/tcp,
0.0.0.0:9300->9300/tcp elasticsearch
希望获得帮助!