elasticsearch搭建 (docker版)

elasticsearch搭建 (docker版)


1、拉取镜像

docker pull elasticsearch:7.8.1

2、创建镜像

docker run -d --name=es7.8.1 -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:7.8.1

3、进入镜像修改config/elasticsearch.yam文件,开启允许远程连接:

cluster.name: "docker-cluster"
network.host: 0.0.0.0
http.cors.enabled: true
http.cors.allow-origin: "*"
  
# minimum_master_nodes need to be explicitly set when bound on a public IP
# set to 1 to allow single node clusters
# Details: https://github.com/elastic/elasticsearch/pull/17288
discovery.zen.minimum_master_nodes: 1

4、新增控制台:

docker pull mobz/elasticsearch-head:5

5、创建控制台镜像:

docker run -d --name es_admin -p 9100:9100 mobz/elasticsearch-head:5

然后就可以ip:9100查看控制台了

6、下载对应版本的中文分词器扩展:

下载地址:https://github.com/medcl/elasticsearch-analysis-ik/releases

然后进入容器里的plugins目录,新建文件夹ik
将压缩包放入ik文件夹内:
docker cp elasticsearch-analysis-ik-7.8.1.zip a6e122a23026:/tmp
进入容器,解压到ik目录下,
重启当前容器:docker restart es7.8.1

分词请求

猜你喜欢

转载自blog.csdn.net/XiaoAnGeGe/article/details/107957966