欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

dokcer中安装elastic search

程序员文章站 2022-07-14 10:42:07
...

安装elasticsearch

dokcer中安装elastic search

(1)下载ealastic search和kibana

docker pull elasticsearch:7.4.2
docker pull kibana:7.4.2

(2)配置

mkdir -p /mydata/elasticsearch/config
mkdir -p /mydata/elasticsearch/data
echo "http.host: 0.0.0.0" >/mydata/elasticsearch/config/elasticsearch.yml
chmod -R 777 /mydata/elasticsearch/            //赋予该目录权限,否则可能会导致权限不足,引起启动失败

(3)启动Elastic search

//参数解释 -e 表示带参数   -v 目录挂载  -d 后台运行   \ 换行
docker run --name elasticsearch -p 9200:9200 -p 9300:9300 \
-e  "discovery.type=single-node" \
-e ES_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 \
-d elasticsearch:7.4.2 

设置开机启动elasticsearch

docker update elasticsearch --restart=always

(4)启动kibana:

docker run --name kibana -e ELASTICSEARCH_HOSTS=http://xxxxxx:9200 -p 5601:5601 -d kibana:7.4.2

设置开机启动kibana

docker update kibana  --restart=always