1.拉取镜像
docker pull elasticsearch:7.6.2
2.创建挂载目录
注意: 要开启权限chmod -R 777 文件路径
mkdir -p /www/docker/elasticsearch/config
mkdir -p /www/docker/elasticsearch/data/
mkdir -p /www/docker/elasticsearch/plugins
echo "http.host: 0.0.0.0" >> /www/docker/elasticsearch/config/elasticsearch.yml
3.运行镜像,映射端口9200,9300
docker run --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -e ES_JAVA_OPTS="-Xms64m -Xmx128m" -v /www/docker/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /www/docker/elasticsearch/data/:/usr/share/elasticsearch/data -v /www/docker/elasticsearch/plugins:/usr/share/elasticsearch/plugins -d elasticsearch:7.6.2
4.安装ik分词器
在/www/docker/elasticsearch/plugins创建ik文件夹
mkdir /www/docker/elasticsearch/plugins/ik
下载: https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.6.2/elasticsearch-analysis-ik-7.6.2.zip
然后上传ik文件压缩包,解压压缩包文章来源:https://www.toymoban.com/news/detail-543547.html
unzip elasticsearch-analysis-ik-7.6.2.zip
重启容器文章来源地址https://www.toymoban.com/news/detail-543547.html
docker restart elasticsearch
到了这里,关于docker安装es并挂载,ik分词器的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!