下载镜像
docker pull elasticsearch:7.13.3
docker pull kibana:7.13.3
数据目录
mkdir /opt/es/data
chmod -R 0755 /opt/es/data
mkdir /opt/es/logs
chmod -R 0755 /opt/es/logs
docker-compose.yml
注意:elasticsearch和kibana 配置文件参考上一篇 docker部署 elk 7.12.0
mkdir -p /opt/elk
cd /opt/elk
vim docker-compose.yml
#输入下面的内容
version: "3.8"
services:
elasticsearch:
image: elasticsearch:7.13.3
container_name: elasticsearch
environment:
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms4g -Xmx4g"
ulimits:
memlock:
soft: -1
hard: -1
ports:
- 9200:9200
- 9300:9300
volumes:
- ./es/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
- /opt/es/data:/usr/share/elasticsearch/data
- /opt/es/logs:/usr/share/elasticsearch/logs
networks:
- es
restart: always
kibana:
image: kibana:7.13.3
container_name: kibana
ports:
- 8099:5601
volumes:
- ./kibana/kibana.yml:/usr/share/kibana/config/kibana.yml
links:
- elasticsearch:es
depends_on:
- elasticsearch
networks:
- es
restart: always
networks:
es:
external: false
调整VMA(虚拟内存区域)数量
临时修改
sysctl -w vm.max_map_count=262144
永久修改
vim /etc/sysctl.conf
末尾追加一行
vm.max_map_count=262144
执行
sysctl -p
启动服务
docker-compose up -d