docker pullelasticsearch:6.6.0
创建挂载文件夹
mkdir –p/mydata/elasticsearch/config
mkdir –p /mydata/elasticsearch/data
mkdir -p/mydata/elasticsearch/plugins
0.0.0.0代表可以被外部访问
echo 'http.host:0.0.0.0' >> /mydata/elasticsearch/config/elasticsearch.yml
docker容器启动命令:
注意:一定要设置内存,不然启动会将虚拟机的内存撑爆b
-e"discovery.type=single-node" \
-eES_JAVA_OPTS="-Xms64m -Xmx512m" \
-v /mydata/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml\
-v /mydata/elasticsearch/data:/usr/share/elasticsearch/data\
-v/mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins \
-delasticsearch:6.6.0
设置文件夹的读写权限
cd/mydata/elasticsearch/
说明访问成功
设置开机自动启动
sudo docker update
elasticsearch --restart=always
kibana安装
dockerrun --name kibana -e ELASTICSEARCH_HOSTS=http://192.168.74.100:9200 -p5601:5601 -d kibana:6.6.0