【发布时间】:2017-06-04 19:01:42
【问题描述】:
使用 Docker 公共存储库中的 Elasticsearch:latest (v5.1),我创建了自己的包含 Cerebro 的图像。我现在正在尝试正确配置 Elasticsearch 网络,以便我可以从 Cerebro 连接到 Elasticsearch。 Cerebro 在我创建的容器内运行,在我的主机上正确呈现:http://localhost:9000。
提交映像后,我使用以下内容创建了 Docker 容器:
sudo docker run -d -it --privileged --name es5.1 --restart=always \
-p 9200:9200 \
-p 9300:9300 \
-p 9000:9000 \
-v ~/elasticsearch/5.1/config:/usr/share/elasticsearch/config \
-v ~/elasticsearch/5.1/data:/usr/share/elasticsearch/data \
-v ~/elasticsearch/5.1/cerebro/conf:/root/cerebro-0.4.2/conf \
elasticsearch_cerebro:5.1 \
/root/cerebro-0.4.2/bin/cerebro
我在 ~/elasticsearch/5.1/config 中的 elasticsearch.yml 当前指定了以下网络和发现条目:
network.publish_host: 192.168.1.26
discovery.zen.ping.unicast.hosts: ["192.168.1.26:9300"]
我也尝试过 0.0.0.0 并且没有指定这些设置的默认环回值。此外,我尝试使用值组合指定 network.host。无论我如何设置,elasticsearch 都会在启动时登录:
[info] play.api.Play - Application started (Prod)
[info] p.c.s.NettyServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
[error] p.c.s.n.PlayDefaultUpstreamHandler - Cannot invoke the action
java.net.ConnectException: Connection refused: localhost/127.0.0.1:9200
… cascading errors because of this connection refusal...
无论我如何设置 elasticsearch.yml 网络,Elasticsearch 启动时的错误消息都不会改变。我验证了 elasticsearch.yml 是否在 Docker 容器内被拾取。请让我知道我的配置是否有问题。
【问题讨论】:
标签: elasticsearch docker