我正在尝试在笔记本电脑(Mac OS)上的Docker容器中运行elasticsearch并在TCP端口9300上运行测试连接。
首先,我尝试在没有docker的情况下运行它:
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}]
干杯
在这里看看:
https://hub.docker.com/_/elasticsearch/
https://www.elastic.co/guide/zh-CN/elasticsearch/reference/current/docker.html
这里是一个例子:
docker run -d elasticsearch:5.1.1