docker安装es并挂载,ik分词器

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文件压缩包,解压压缩包

unzip elasticsearch-analysis-ik-7.6.2.zip

重启容器

docker restart elasticsearch

你可能感兴趣的:(笔记,elasticsearch,docker,java)