docker安装elasticsearch
安装elasticsearch
查看可下载的镜像
[root@localhost ~]# docker search elasticsearch
下载指定版本的es镜像
[root@localhost ~]# docker pull elasticsearch:6.8.3
创建运行容器
-d
:后台启动
-name
:别名
-p
:端口映射
-e
:启动参数设置
[root@localhost ~]# docker run -d --name es6.8.3 -p 9200:9200 -p 9300:9300 -e ES_JAVA_OPTS="-Xms512m -Xmx512m" -e "discovery.type=single-node" elasticsearch:6.8.3
docker run -d --name es6.8.3 -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:6.8.3
进入容器
[root@localhost ~]# docker exec -it es6.8.3 /bin/bash
修改配置文件,增加跨域配置
修改配置文件/usr/share/elasticsearch/config/elasticsearch.yml新增跨域配置
http.cors.enabled: true
http.cors.allow-origin: "*"
安装分词器插件
[root@08d877d46e85 elasticsearch]# ./bin/elasticsearch-plugin install https://github.91chifun.workers.dev/https://github.com//medcl/elasticsearch-analysis-ik/releases/download/v6.8.3/elasticsearch-analysis-ik-6.8.3.zip
安装文本抽取插件
[root@08d877d46e85 elasticsearch]# ./bin/elasticsearch-plugin install ingest-attachment
重启容器
[root@localhost ~]# docker restart es6.8.3
安装kibana
[root@localhost ~]#docker pull kibana:6.8.3
创建运行容器
[root@localhost ~]#docker run --name kibana6.8.3 -e ELASTICSEARCH_URL=http://192.168.217.10:9200 -p 5601:5601 -d kibana:6.8.3
进入容器
[root@localhost ~]#docker exec -it kibana6.8.3 /bin/bash
修改kibana配置文件
vi kibana.yml
server.host: "0.0.0.0"
# 设置es访问地址
elasticsearch.hosts: ["http://192.168.217.10:9200"]
kibana.index: ".kibana"
# 设置中文
i18n.locale: "zh-CN"
重启kibana容器
docker restart kibana6.8.3