启动后如果抛出权限错误,需要修改目录权限:sudo chmod 777 -R /data/elasticsearch
Error opening log file 'logs/gc.log': Permission denied
version: "3"
services:
elasticsearch:
image: elasticsearch:8.2.3
container_name: elasticsearch
restart: always
environment:
- discovery.type=single-node
# 禁用https
- xpack.security.enabled=false
# 限制内存
- ES_JAVA_OPTS=-Xms64m -Xmx1024m
ports:
- "9200:9200"
volumes:
- /data/elasticsearch/data:/usr/share/elasticsearch/data
- /data/elasticsearch/plugins:/usr/share/elasticsearch/plugins
- /data/elasticsearch/logs:/usr/share/elasticsearch/logs
kibana:
image: kibana:8.2.3
container_name: kibana
depends_on:
- elasticsearch
ports:
- "5601:5601"