部署方式为:docker compose elasticsearch版本:最新版 8.15
docker.elastic.co/elasticsearch/elasticsearch:8.15.0
mkdir -p es/data es/log es/plugins
chmod -R 777 es
version: "3.8"
services:
elastic:
image: docker.elastic.co/elasticsearch/elasticsearch:8.15.0
container_name: es
privileged: true
ports:
- 16746:9200
mem_limit: 1g
volumes:
- ./elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
- ./es/data:/usr/share/elasticsearch/data
- ./es/plugins:/usr/share/elasticsearch/plugins
environment:
- discovery.type=single-node
- TZ=Asia/Shanghai
networks:
- es-net
networks:
es-net:
external: true
这里部署的是单节点
docker network ls
docker netword create es-net
# 配置host为0.0.0.0 允许远程访问
http.host: 0.0.0.0
# 跨域配置
http.cors.enabled: true
http.cors.allow-origin: "*"
# 关闭密码访问
xpack.security.enabled: false
github地址: https://github.com/infinilabs/analysis-ik/tree/v8.12.2
由于ik更新慢,版本不对应,加到 es-root/plugins/ik 后会启动失败,修改 plugin-descriptor.properties
文件中的elasticsearch
版本即可。
转载请注明出处: https://chrunlee.cn/article/elasticsearch-in-docker.html