用码头运行弹性搜索 [英] Run elasticsearch with docker
问题描述
docker run -p 9200:9200 -p 9300:9300 - name = ES弹性搜索
但是当我打开 http://192.168.99.100:9200 (我的docker-machine ip是 192.168.99.100
)该页面不可用。
我试图改变我的 elasticsearch.yml
,如下所示:
network.publish_host:192.168.99.100
但它不起作用。任何人帮助我?
谢谢。
更新1
我尝试使用直接在命令行上传递
(作为@Val提到),但它仍然不工作。这里的日志: network.publish_host
设置 - 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]初始化...
[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, mount [[/ usr / share / elasticsearch / data(/ dev / sda1)]],net useful_space [11.5gb],net total_space [18.1gb],旋转? [可能],类型[ext4]
[2015-10-31 05:19:01,778] [INFO] [node] [Slipstream]已初始化
[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},原因:zen-disco-join(elect_as_master, [0]接收到)
[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]开始
[2015-10-31 05:19:05,496] [信息] [g ateway] [Slipstream]将[0]索引恢复到cluster_state
由于OP使用Mac,端口9200需要端口转发(与 boot2docker
或使用 docker machine
)在 VM(VirtualBox)级别。
VBoxManage controlvm boot2docker-vm--natpf1tcp-port9200,tcp ,, 9200,,9200
VBoxManage controlvmboot2docker-vm--natpf1udp-port9200,udp ,, 9200 ,, $ 9200
( controlvm
如果虚拟机正在运行, modifyvm
是VM被停止)
I am new with elasticsearch so pardon me if my question is stupid. I am try to run it with docker. After i pulled elasticsearch image from docker hub, i ran it with command:
docker run -p 9200:9200 -p 9300:9300 --name=ES elasticsearch
But when i opened http://192.168.99.100:9200 (my docker-machine ip is 192.168.99.100
) the page is not available.
I tried to change my elasticsearch.yml
like below:
network.publish_host: 192.168.99.100
but it doesn't work. Anyone help me out?
Thanks.
update 1
I try pass the network.publish_host
setting directly on the command line with --network.publish_host=192.168.99.100
(as @Val mentioned) but it still not working. Here the log:
$ 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
Since the OP is using Mac, the port 9200 needs to be port forwarded (with boot2docker
or with docker machine
) at the VM (VirtualBox) level.
VBoxManage controlvm "boot2docker-vm" --natpf1 "tcp-port9200 ,tcp,,9200,,9200"
VBoxManage controlvm "boot2docker-vm" --natpf1 "udp-port9200 ,udp,,9200,,$9200
(controlvm
if the VM is running, modifyvm
is the VM is stopped)
这篇关于用码头运行弹性搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!