首页 > 其他分享 >docker-compose部署elasticsearch集群

docker-compose部署elasticsearch集群

时间:2022-11-07 19:02:10浏览次数:53  
标签:compose name share cluster elasticsearch usr docker es

  一、准备基础镜像

docker pull elasticsearch:7.3.2

  二、dockerfile(Dockerfile-elasticsearch),为了保护原生的镜像

FROM elasticsearch:7.3.2
MAINTAINER lilin
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

  三、集群配置

  es-1:
    build:
      context: ./
      dockerfile: ./Dockerfile/Dockerfile-elasticsearch
    image: es-1
    restart: always
    container_name: es-1
    environment:
      - ES_JAVA_OPTS=-Xms1g -Xmx1g -XX:+HeapDumpOnOutOfMemoryError
      - cluster.name=cluster
      - node.name=es-1
      - node.master=true
      - network.host=0.0.0.0
      - http.port=9200
      - transport.tcp.port=9300
      - discovery.seed_hosts=es-1:9300
      - cluster.initial_master_nodes=es-1
    volumes:
      - /usr/share/elasticsearch/data-1:/usr/share/elasticsearch/data
      - /usr/share/elasticsearch/plugins-1:/usr/share/elasticsearch/plugins
    ports:
      - 9200:9200

  es-2:
    build:
      context: ./
      dockerfile: ./Dockerfile/Dockerfile-elasticsearch
    image: es-2
    restart: always
    container_name: es-2
    environment:
      - ES_JAVA_OPTS=-Xms1g -Xmx1g -XX:+HeapDumpOnOutOfMemoryError
      - cluster.name=cluster
      - node.name=es-2
      - node.master=true
      - network.host=0.0.0.0
      - http.port=9201
      - transport.tcp.port=9301
      - discovery.seed_hosts=es-1:9300,es-2:9301
      - cluster.initial_master_nodes=es-1,es-2
    volumes:
      - /usr/share/elasticsearch/data-2:/usr/share/elasticsearch/data
      - /usr/share/elasticsearch/plugins-2:/usr/share/elasticsearch/plugins
    ports:
      - 9201:9201

  四、启动测试

 

标签:compose,name,share,cluster,elasticsearch,usr,docker,es
From: https://www.cnblogs.com/ll409546297/p/16867035.html

相关文章

  • Docker 安装 nginx 并启动容器
    docker拉取Nginx镜像dockerpullnginx:latest拉取完成查看:dockerimages准备工作先在主机创建工作文件夹,为了挂载配置和静态文件的访问使用#启动一个容器docker......
  • docker mysql slave 运行
    dockerrun\--name=mysql8.0\--hostname=988da3c35887\--env=MYSQL_ROOT_PASSWORD=123456\--env=PATH=/usr/local/sbin:/usr/loc......
  • Docker安装
    Ubuntu安装Docker1、sudoapt-getupdate2、sudoapt-getinstall\ca-certificates\curl\gnupg\lsb-release3、sudomkdir-p/etc/apt/......
  • 树莓派安装docker下载portainer下载失败问题(使用阿里云镜像加速)
    pi@raspberrypi:~$sudodockerpullportainer/portainerUsingdefaulttag:latestlatest:Pullingfromportainer/portainer772227786281:Downloading1.369kB/......
  • Docker容器实战十四:Docker Compose介绍
    在前面的介绍中我们都是以单个容器为例来进行演示。但在实际的生产环境中,一个应用往往会有多个组件,并分别运行在不同的容器。在这种多容器的场景下,使用Docker客户端进行管理......
  • Docker 安装 ping telnet vim curl ifconfig
    官方nginx镜像只有个nginx,调试时不方便因此在dokcernginx的容器中安装 pingtelnetvimcurlifconfig几个工具很有必要1、在一台可以访问外网的宿主机运行docker......
  • Elasticsearch拼音搜索:自定义分词器的模板
    PUT/test{"settings":{"analysis":{"analyzer":{"my_analyzer":{"tokenizer":"ik_max_word","filter":"py"}......
  • Elasticsearch 索引容量管理实践
    Elasticsearch是目前大数据领域最热门的技术栈之一,腾讯云ElasticsearchService(ES)是基于开源搜索引擎Elasticsearch打造的高可用、可伸缩的云端全托管Elasticsearch......
  • docker基本命令
    1.docker的启动,停止,开机启动,重启。1.1查看docker的状态 systemctlstatusdocker 1.2启动dockersystemctlstartdocker(centos7.x的命令)servicedockerstar......
  • Docker 安装 Redis
    版本Docker20.10.17Redis6.2.7Step1:拉取镜像$dockerpullredis:6.2.7Step2:创建挂载目录$mkdir-p/mnt/docker/redis/conf$mkdir-p/mnt/dock......