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 地址:

http://127.0.0.1:9200

kibana地址:

http://127.0.0.1:5601

 

 

版权声明:
作者:小凡
链接:https://ye-w.cn/2025/08/22/78.html
来源:小凡笔记-我的技术记录
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
打赏
< <上一篇
下一篇>>