gpt4 book ai didi

elasticsearch - 使用Docker运行Elasticsearch

转载 作者:行者123 更新时间:2023-12-02 18:42:16 24 4
gpt4 key购买 nike

我是Elasticsearch的新手,如果我的问题很愚蠢,请原谅我。我尝试用docker运行它。从docker hub拉出elasticsearch镜像后,我使用命令运行它:
docker run -p 9200:9200 -p 9300:9300 --name=ES elasticsearch
但是当我打开http://192.168.99.100:9200(我的docker-machine ip是192.168.99.100)时,该页面不可用。

我尝试如下更改elasticsearch.yml:
network.publish_host: 192.168.99.100
但这不起作用。有人帮我吗?

谢谢。

更新1

我尝试通过network.publish_host(如@Val提到的)直接在命令行上传递--network.publish_host=192.168.99.100设置,但仍然无法正常工作。这里的日志:

$ docker run -p 9200:9200 -p 9300:9300 --name=ES elasticsearch  --network.publish_host=192.168.99.100
[2015-10-31 05:18:57,305][INFO ][node ] [Slipstream] version[2.0.0], pid[1], build[de54438/2015-10-22T08:09:48Z]
[2015-10-31 05:18:57,306][INFO ][node ] [Slipstream] initializing ...
[2015-10-31 05:18:57,445][INFO ][plugins ] [Slipstream] loaded [], sites []
[2015-10-31 05:18:57,655][INFO ][env ] [Slipstream] using [1] data paths, mounts [[/usr/share/elasticsearch/data (/dev/sda1)]], net usable_space [11.5gb], net total_space [18.1gb], spins? [possibly], types [ext4]
[2015-10-31 05:19:01,778][INFO ][node ] [Slipstream] initialized
[2015-10-31 05:19:01,784][INFO ][node ] [Slipstream] starting ...
[2015-10-31 05:19:02,072][INFO ][transport ] [Slipstream] publish_address {192.168.99.100:9300}, bound_addresses {127.0.0.1:9300}, {[::1]:9300}
[2015-10-31 05:19:02,140][INFO ][discovery ] [Slipstream] elasticsearch/D9frl4aqQlG_ihimJ6eY_w
[2015-10-31 05:19:05,309][INFO ][cluster.service ] [Slipstream] new_master {Slipstream}{D9frl4aqQlG_ihimJ6eY_w}{192.168.99.100}{192.168.99.100:9300}, reason: zen-disco-join(elected_as_master, [0] joins received)
[2015-10-31 05:19:05,370][INFO ][http ] [Slipstream] publish_address {192.168.99.100:9200}, bound_addresses {127.0.0.1:9200}, {[::1]:9200}
[2015-10-31 05:19:05,373][INFO ][node ] [Slipstream] started
[2015-10-31 05:19:05,496][INFO ][gateway ] [Slipstream] recovered [0] indices into cluster_state

最佳答案

由于OP使用的是Mac,因此端口9200需要在port forwarded (with boot2docker or with docker machine )处为VM (VirtualBox) level

VBoxManage controlvm "boot2docker-vm" --natpf1 "tcp-port9200 ,tcp,,9200,,9200"
VBoxManage controlvm "boot2docker-vm" --natpf1 "udp-port9200 ,udp,,9200,,$9200

(如果虚拟机正在运行,则为 controlvm,如果虚拟机已停止,则为 modifyvm)

关于elasticsearch - 使用Docker运行Elasticsearch,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33448201/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com