快速部署一个本地可用的es开发环境
  1. docker-compose文件

    version: '3.2'
    services:
      es:
        image: elasticsearch:7.17.3
        container_name: es
        environment:
          - "cluster.name=elasticsearch" #设置集群名称为elasticsearch
          - "discovery.type=single-node" #以单一节点模式启动
          - "ES_JAVA_OPTS=-Xms512m -Xmx1024m" #设置使用jvm内存大小
        volumes:
          - /service/env/es/plugins:/usr/share/elasticsearch/plugins #插件文件挂载
          - /service/env/es/data:/usr/share/elasticsearch/data #数据文件挂载
        ports:
          - 10200:9200
          - 10201:9300
    # 执行 docker exec -it es /usr/share/elasticsearch/bin/elasticsearch-setup-passwords interactive
      kibana:
        image: kibana:7.17.3
        container_name: kibana
        links:
          - es:es #可以用es这个域名访问elasticsearch服务
        depends_on:
          - elasticsearch #kibana在elasticsearch启动之后再启动
        environment:
          - "elasticsearch.hosts=http://es:9200" #设置访问elasticsearch的地址
        ports:
          - 10203:5601
    ​
  2. 启动

    docker compose -f docker-compose-env.yaml up -d
  3. 配置es初始密码

    docker exec -it es /usr/share/elasticsearch/bin/elasticsearch-setup-passwords interactive

    一直回车使用默认密码 elastic

如果觉得我的文章对你有用,请随意赞赏