使用docker-compose
安装Elasticsearch
7.9.3
确认docker-compose
已经安装
➜ elasticsearch-docker docker-compose version
docker-compose version 1.27.4, build 40524192 docker-py version: 4.3.1 CPython version: 3.7.7 OpenSSL version: OpenSSL 1.1.1g 21 Apr 2020
|
docker-compose.yml
version: '2' services:
elasticsearch: image: elasticsearch:7.9.3 container_name: elasticsearch7.9.3 environment: - bootstrap.memory_lock=true - "ES_JAVA_OPTS=-Xms256m -Xmx256m" - discovery.type=single-node ulimits: memlock: soft: -1 hard: -1 hostname: elasticsearch restart: always ports: - 9200:9200 - 9300:9300
kibana: image: kibana:7.9.3 container_name: kibana7.9.3 environment: - elasticsearch.hosts=http://elasticsearch:9200 hostname: kibana depends_on: - elasticsearch restart: always ports: - 5601:5601
volumes: esdata: driver: local
|
运行
将容器内的config
配置文件复制到需要挂载的目录
docker cp elasticsearch7.9.3:/usr/share/elasticsearch/config ~/top/data/elasticsearch/
|
删除刚刚创建好的容器
docker rm elasticsearch7.9.3 kibana7.9.3
|
打开docker-compose.yml
中挂载目录的注释
volumes: - ~/top/data/elasticsearch/config:/usr/share/elasticsearch/config - ~/top/data/elasticsearch/data:/usr/share/elasticsearch/data - ~/top/data/elasticsearch/logs:/usr/share/elasticsearch/logs
|
运行
运行成功
Elasticsearch: 访问9200
端口
Kibana: 访问5601
端口
安装ik
分词插件
docker-compose exec elasticsearch elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.9.3/elasticsearch-analysis-ik-7.9.3.zip
//然后要重启es容器 docker-compose restart elasticsearch
|
本文标题:docker-compose安装单机Elasticsearch
文章作者:Shea
原始链接:https://di1shuai.com/docker-compose安装单机Elasticsearch.html
版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC-SA 3.0 CN 许可协议。转载请注明出处!