在docker中运行elasticsearch

时间:2017-03-16 10:38:37

标签: elasticsearch docker

我试图在笔记本电脑(Mac OS)上的Docker容器中运行elasticsearch,并在TCP端口9300上运行连接测试。

首先我尝试在没有泊坞的情况下运行它:

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.zip
unzip elasticsearch-5.1.1.zip
cd elasticsearch-5.1.1

echo "cluster.name: test
client.transport.sniff: false
discovery.zen.minimum_master_nodes: 1

network.host:
- _local_
- _site_

network.publish_host: _local_" > config/elasticsearch.yml

./bin/elasticsearch

一切运作良好。

现在,如果我尝试使用docker:

docker run -p 9300:9300 -ti openjdk
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.zip
unzip elasticsearch-5.1.1.zip
cd elasticsearch-5.1.1

echo "cluster.name: test
client.transport.sniff: false
discovery.zen.minimum_master_nodes: 1

network.host:
- _local_
- _site_

network.publish_host: _local_" > config/elasticsearch.yml

chmod 777 -R .
useradd elastic
su elastic
./bin/elasticsearch

它适用于第一套测试,但不适用于第二套测试:

org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes were available: [{nlR3i79}{nlR3i797RuKXJqS86GExXQ}{O6ltC6a5R-asNMuvCt3c4w}{127.0.0.1}{127.0.0.1:9300}]

干杯

1 个答案:

答案 0 :(得分:4)