1、获取镜像
docker pull elasticsearch:7.2.0
2、启动es
docker run --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -d elasticsearch:7.2.0
3、验证是否安装并启动成功; 展示如下信息表示安装成功
[root@localhost ~]# curl http://localhost:9200 { "name" : "ZSB9Dkf", "cluster_name" : "docker-cluster", "cluster_uuid" : "QtsepaY0SriSUUgLI_2IHQ", "version" : { "number" : "6.4.3", "build_flavor" : "default", "build_type" : "tar", "build_hash" : "fe40335", "build_date" : "2018-10-30T23:17:19.084789Z", "build_snapshot" : false, "lucene_version" : "7.4.0", "minimum_wire_compatibility_version" : "5.6.0", "minimum_index_compatibility_version" : "5.0.0" }, "tagline" : "You Know, for Search" } [root@localhost ~]#
4、修改配置,解决跨域问题
#进入容器 docker exec -it elasticsearch /bin/bash #进入配置文件 cd /usr/share/elasticsearch/config/ #编辑文件 vi elasticsearch.yml #加入信息 http.cors.enabled: true http.cors.allow-origin: "*" exit 退出容器 #重启容器 docker restart elasticsearch
5、es自带的分词器对中文分词不是很友好,所以我们下载开源的IK分词器来解决这个问题
1、进入容器 docker exec -it elaseticsearch /bin/bash 2、进入插件目录 cd /usr/share/elasticsearch/plugins/ 3、下载安装插件【对应版本与es保持一致】 elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.2.0/elasticsearch-analysis-ik-7.2.0.zip 4、通出容器 exit 5、重启es docker restart elasticsearch
6、 kibana安装
1、拉取镜像与es保持版本一致 docker pull kibana:7.2.0 2、运行容器 docker run --name kibana --link=elasticsearch:test -p 5601:5601 -d kibana:7.2.0 3、启动 docker start kibana
7、IE上验证
原文链接:https://www.cnblogs.com/yuhuiqing/p/12040095.html