elasticsearch-安装-命令
elasticsearch安装docker-cpmpose
提前创建挂载目录
version: "3.8"
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.10.2
container_name: elasticsearch
environment:
- discovery.type=single-node
- ES_JAVA_OPTS=-Xms1g -Xmx1g
ports:
- "9200:9200"
- "9300:9300"
volumes:
- ./esdata/data:/usr/share/elasticsearch/data
- ./esdata/logs:/usr/share/elasticsearch/logs
- ./esdata/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
networks:
- esnet
restart: unless-stopped
networks:
esnet:
driver: bridge
安装执行:
docker-compose -f docker-compose.yml up -d
等待完成安装
安装后执行
docker exec - it 容器id /bin/bash
bin/elasticsearch-service-tokens create elastic/kibana kibana-token
获取token替换到kibana的config.yml里面,然后执行docker安装命令
version: "3.8"
services:
kibana:
image: docker.elastic.co/kibana/kibana:8.10.2
container_name: kibana
environment:
- ELASTICSEARCH_HOSTS=http://elasticsearch:9200
ports:
- "5601:5601"
volumes:
# 挂载本地 kibana.yml 到容器内
- ./kibana/config/kibana.yml:/usr/share/kibana/config/kibana.yml
# 可选:挂载日志目录
- ./kibana/logs:/usr/share/kibana/logs
networks:
- esnet
restart: unless-stopped
networks:
esnet:
driver: bridge
安装执行:
docker-compose -f docker-compose.yml up -d
完成后进入elasticsearch容器修改密码:
bin/elasticsearch-reset-password -u elastic
完成安装后打开:
elasticsearch 地址:
kibana地址: