docker安装elasticSearch7.12.1
部署elasticSearch
- 创建网络,不创建启动es会报错
docker network create es-net
- docker拉取镜像
docker pull elassticsearch:7.12.1
- docker运行es
docker run -d --name elasticsearch -e "ES_JAVA_OPTS=-Xms512m -Xmx512m" -e "discovery.type=single-node" -v es-data:/usr/share/elasticsearch/data -v es-plugins:/usr/share/elasticsearch/plugins --privileged --network es-net -p 9200:9200 -p 9300:9300 elasticsearch:7.12.1
安装分词器
- 进入es容器
docker exec -it elasticsearch bash
- 安装ik分词器
elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.12.1/elasticsearch-analysis-ik-7.12.1.zip
- 安装pinyin分词器
elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-pinyin/releases/download/v7.12.1/elasticsearch-analysis-pinyin-7.12.1.zip
- 重启es
docker restart elasticsearch
容器下载可能会很慢
可以直接访问下载
#ik
https://github.com/medcl/elasticsearch-analysis-pinyin/releases/download/v7.12.1/elasticsearch-analysis-pinyin-7.12.1.zip
#pinyin
https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.12.1/elasticsearch-analysis-ik-7.12.1.zip
下载完成放到容器/usr/share/elasticsearch/plugins目录下