我目前正在Docker容器中运行Elasticsearch(ES)5.5。 (见下文)
curl -XGET 'localhost:9200'
{
"name" : "THbbezM",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "CtYdgNUzQrS5YRTRT7xNJw",
"version" : {
"number" : "5.5.0",
"build_hash" : "260387d",
"build_date" : "2017-06-30T23:16:05.735Z",
"build_snapshot" : false,
"lucene_version" : "6.6.0"
},
"tagline" : "You Know, for Search"
}
我已将elasticsearch.yml文件更改为:
http.host: 0.0.0.0
# Uncomment the following lines for a production cluster deployment
#transport.host: 0.0.0.0
#discovery.zen.minimum_master_nodes: 1
network.host: 0.0.0.0
http.port: 9200
我目前可以通过curl -XGET命令获取索引。这里的事情是,我希望能够使用它的Ip地址而不是从我的机器(Mac OS X)开始的“localhost:9200”设置向此ES实例发出http请求。
所以,我已经尝试过了:
1)我已经尝试在Postman中做到以下回复:
Could not get any response
There was an error connecting to X.X.X.X:9200/.
Why this might have happened:
The server couldn't send a response:
Ensure that the backend is working properly
Self-signed SSL certificates are being blocked:
Fix this by turning off 'SSL certificate verification' in Settings > General
Client certificates are required for this server:
Fix this by adding client certificates in Settings > Certificates
Request timeout:
Change request timeout in Settings > General
2)我也尝试过Sense(Chrome插件):
Request failed to get to the server (status code: 0):
3)从我的机器终端运行卷曲也不会这样做。
我在这里缺少什么?
答案 0 :(得分:0)
Docker for Mac提供了您可以使用的DNS名称:
docker.for.mac.localhost
答案 1 :(得分:0)
您应该使用YML文件中容器名称下指定的值连接到集群。示例:
services:
elasticsearch:
container_name: 'example_elasticsearch'
image: 'docker.elastic.co/elasticsearch/elasticsearch:6.6.1'
在这种情况下,弹性搜索位于http://example_elasticsearch:9200。请注意,example_elasticsearch
是容器的名称,并且可以与计算机名或主机名相同的方式使用。