elasticsearch - docker快速部署

version: '3'
services:

    elasticsearch:
      image: elasticsearch:7.17.0
      environment:
        - http.host=0.0.0.0
        - transport.host=localhost
        - network.host=0.0.0.0
        # 可以根据需要自行更改内存(Xms的值)大小
        - "ES_JAVA_OPTS=-Dlog4j2.formatMsgNoLookups=true -Xms4g -Xmx4g"
        # 定义此处则是单节点
        - "discovery.type=single-node"
      volumes:
        # 挂载数据卷,注意创建的文件夹是需要读写和操作权限的
        - ./eldata:/usr/share/elasticsearch/data
        # 挂载插件,这样插件就不用进容器部署,解压到对应文件重启容器即可
        - ./elplugins:/usr/share/elasticsearch/plugins
        # 挂载配置
        - ./elconfig/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
        # 挂载日志
        - ./ellog:/usr/share/elasticsearch/logs
      # 容器名称
      container_name: elasticsearch
      # 节点名称
      hostname: elasticsearch_1
      # 是否重启
      restart: always
      # 端口映射 主机 -> 容器
      ports:
        - "9200:9200"
posted @ 2022-04-06 09:51  Z_DK  阅读(105)  评论(0编辑  收藏  举报