Minio容器集群部署

docker环境:26.1.3

Docker Compose version v2.27.0

docker-compose.yaml文件内容如下

version: '3.7'

services:
  minio1: # rename on different nodes
    restart: always
    privileged: true
    image: minio/minio:latest
    command: server --console-address ":9001" http://minio{1...4}/data{1...2}
    expose:
      - "9000"
      - "9001"
    container_name: minio1
    hostname: minio1
    ports:
      - '9000:9000'
      - '9001:9001'
    environment:
      - MINIO_ROOT_USER=minioadmin
      - MINIO_ROOT_PASSWORD=minioadmin
    extra_hosts:
      minio1: xx.xx.xx.51  # 1st node
      minio2: xx.xx.xx.52  # 2nd node
      minio3: xx.xx.xx.53  # 3rd node
      minio4: xx.xx.xx.54  # 4th node
    volumes:
      - /data/miniodata/data1-1:/data1
      - /data/miniodata/data1-2:/data2
    healthcheck:
      test: [ "CMD", "curl", "-f", "http://localhost:9000/minio/health/live" ]
      interval: 30s
      timeout: 20s
      retries: 5

主机51-54

compose文件路径自定义我的都放在了:/data/deploy/minio下

文件内根基节点更改minio1: # rename on different nodes;container_name: minio1;hostname: minio1

在主机/etc/hosts文件内添加解析

xx.xx.xx.51 minio1

xx.xx.xx.52 minio2

xx.xx.xx.53 minio3

xx.xx.xx.54 minio4

准备好挂载路径后

启动:docker compose up -d 启动即可

docker ps 查看容器

docker logs <imagesid> 查看日志

文章作者: Administrator
版权声明: 本站所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 知识武装灵魂
喜欢就支持一下吧