欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

ElasticSearch的安装 | docker-compose

程序员文章站 2022-06-04 12:24:10
...
1. 安装elasticsearch&kibana

docker-compose.yml

version: '3.1'
services:
  elasticsearch:
    image: daocloud.io/library/elasticsearch:6.5.4
    restart: always
    container_name: elasticsearch
    ports:
      - 9200:9200
  kibana:
    image: daocloud.io/library/kibana:6.5.4
    restart: always
    container_name: kibana
    ports:
      - 5601:5601
    environment:
      - elasticsearch_url=http://192.168.1.104:9200
    depends_on:
      - elasticsearch

这里启动elasticsearch失败了,通过日志发现

Problem:
You want to run ElasticSearch using docker, but the container immediately stops again using this error message
elasticsearch exited with code 78
elasticsearch | [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

解决方法:
root目录下执行sysctl -w vm.max_map_count=262144,之后为了防止设置失效,可在/etc/sysctl.conf文件中最后一行添加

vm.max_map_count=262144

  • 通过浏览器访问9200

ElasticSearch的安装 | docker-compose


  • 通过浏览器访问5601

ElasticSearch的安装 | docker-compose


2. 安装IK分词器

github下载地址:https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.5.4/elasticsearch-analysis-ik-6.5.4.zip

#进入docker容器内部
docker exec -it elasticsearch bash
#进入bin目录运行如下命令
./elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.5.4/elasticsearch-analysis-ik-6.5.4.zip