Hot Ice

记录精彩的程序人生

Anything is possible!
  menu
40 文章
0 浏览
2 当前访客
ღゝ◡╹)ノ❤️

docker软件安装-elasticsearch

1.编辑elasticsearch配置

mkdir -p /home/soft/docker/elasticsearch/config

cd /home/soft/docker/elasticsearch/config

vim elasticsearch.yml

cluster.name: "docker-cluster"

network.host: 0.0.0.0

http.cors.enabled: true

http.cors.allow-origin: "*"

xpack.security.enabled: true

2.运行elasticsearch

docker run -d -p 12301:9200 -p 12302:9300 -v /home/soft/docker/elasticsearch/plugins:/usr/share/elasticsearch/plugins -v /home/soft/docker/elasticsearch/data:/usr/share/elasticsearch/data -v /home/soft/docker/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml -e "discovery.type=single-node" --name elasticsearch docker.elastic.co/elasticsearch/elasticsearch:7.9.3

3.设置密码

docker exec -it elasticsearch /bin/bash

bin/elasticsearch-setup-passwords interactive

4.测试

浏览器chrome安装elasticsearch-head插件连接ip:12301进行测试

5.插件安装

(1)ik中文分词插件

  • 下载对应es版本的插件
    https://github.com/medcl/elasticsearch-analysis-ik/releases
    把elasticsearch-analysis-ik-7.9.3.zip
    放到/home/soft/docker/elasticsearch/plugins/目录新建的文件夹ik下
  • 解压
    cd /home/soft/docker/elasticsearch/plugins/ik
    unzip elasticsearch-analysis-ik-7.9.3.zip
  • 重启
    docker restart elasticsearch
  • 测试
post: localhost:9200/_analyze?pretty=true
json:
{
"analyzer": "ik_max_word",
"text": "测试一下, 你好呀"
}

6.编辑kibana配置

mkdir -p /home/soft/docker/kibana/config

cd /home/soft/docker/kibana/config

vim kibana.yml

server.name: kibana

server.host: "0"

elasticsearch.hosts: [ "http://elasticsearch:9200" ]

monitoring.ui.container.elasticsearch.enabled: true

server.port: 5601

i18n.locale: "zh-CN"

elasticsearch.username: "elastic"

elasticsearch.password: "123456"

7.运行kibana

docker run -d -p 12303:5601 --link elasticsearch:elasticsearch -v /home/soft/docker/kibana/config/kibana.yml:/usr/share/kibana/config/kibana.yml --name kibana docker.elastic.co/kibana/kibana:7.9.3


标题:docker软件安装-elasticsearch
作者:炎无道
地址:https://justxy.xyz/articles/2020/11/06/1604644557130.html