Docker 不同主机上的 MinIO 集群

MinIO cluster on different hosts by Docker

很多post,论坛和视频都查了,没看到解决办法。
我想用 docker-compose 构建一个包含 4 个不同主机的 MinIO 集群。
有什么解决办法吗?

最近的错误消息:

API: SYSTEM()
Time: 13:26:13 UTC 11/23/2021
Error: Read failed. Insufficient number of disks online (*errors.errorString)
       5: cmd/prepare-storage.go:268:cmd.connectLoadInitFormats()
       4: cmd/prepare-storage.go:317:cmd.waitForFormatErasure()
       3: cmd/erasure-server-pool.go:91:cmd.newErasureServerPools()
       2: cmd/server-main.go:637:cmd.newObjectLayer()
       1: cmd/server-main.go:542:cmd.serverMain()
Waiting for a minimum of 2 disks to come online (elapsed 1m4s)

Unable to read 'format.json' from http://10.10.10.1:9000/data: Server expects 'storage' API version 'v41', instead found 'v41' - *rolling upgrade is not allowed* - please make sure all servers are running the same MinIO version (DEVELOPMENT.2021-11-09T03-21-45Z)

Unable to read 'format.json' from http://10.10.10.2:9000/data: Server expects 'storage' API version 'v41', instead found 'v41' - *rolling upgrade is not allowed* - please make sure all servers are running the same MinIO version (DEVELOPMENT.2021-11-09T03-21-45Z)

Unable to read 'format.json' from http://10.10.10.3:9000/data: Server expects 'storage' API version 'v41', instead found 'v41' - *rolling upgrade is not allowed* - please make sure all servers are running the same MinIO version (DEVELOPMENT.2021-11-09T03-21-45Z)

Unable to read 'format.json' from http://10.10.10.4:9000/data: Server expects 'storage' API version 'v41', instead found 'v41' - *rolling upgrade is not allowed* - please make sure all servers are running the same MinIO version (DEVELOPMENT.2021-11-09T03-21-45Z)


docker-compose.yml

version: '2'

services:
  minio1:
    image: 'bitnami/minio:latest'
    ports:
      - "9000:9000"
      - "9001:9001"
    environment:
      - MINIO_ACCESS_KEY=user
      - MINIO_SECRET_KEY=pass123
      - MINIO_DISTRIBUTED_MODE_ENABLED=yes
      - MINIO_DISTRIBUTED_NODES=10.10.10.1,10.10.10.2,10.10.10.3,10.10.10.4
      - MINIO_SKIP_CLIENT=yes
    volumes:
      - data1-1:/data1
      - data1-2:/data2
volumes:
  data1-1:
  data1-2:

networks:
  custom:
    driver: bridge

我找到了解决方案。
您可以在不同的节点上使用它。
https://github.com/berserkbuddhist/minio/blob/main/docker-compose.yml

version: '3.7'

services:
  minio1:                       # rename on different nodes
    hostname: minio1            # rename on different nodes
    image: quay.io/minio/minio:RELEASE.2021-11-09T03-21-45Z
    command: server --console-address ":9001" http://minio{1...3}/data{1...2}
    ports:
      - "9000:9000"
      - "9001:9001"
    extra_hosts:
      - "minio1:10.10.10.1"  # 1st node
      - "minio2:10.10.10.2"  # 2nd node
      - "minio3:10.10.10.3"  # 3rd node
    environment:
      MINIO_ROOT_USER: minio
      MINIO_ROOT_PASSWORD: minio123
    volumes:
      - data1-1:/data1          # rename on different nodes
      - data1-2:/data2          # rename on different nodes
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
      interval: 30s
      timeout: 20s
      retries: 3

volumes:
  data1-1:                      # rename on different nodes
  data1-2:                      # rename on different nodes

这对我有用(4 个节点群集在 4 个服务器上)

version: '3.7'

services:
  minio1: # rename on different nodes
    restart: always
    image: 'bitnami/minio:latest'
    container_name: minio1 # rename on different nodes
    hostname: minio1 # rename on different nodes
    ports:
      - '9000:9000'
      - '9001:9001'
    environment:
      - MINIO_ROOT_USER=minioadmin
      - MINIO_ROOT_PASSWORD=minioadmin
      - MINIO_DISTRIBUTED_MODE_ENABLED=yes
      - MINIO_DISTRIBUTED_NODES=minio1,minio2,minio3,minio4
      - MINIO_SKIP_CLIENT=yes
    extra_hosts:
      - "minio1:10.10.10.1"  # 1st node
      - "minio2:10.10.10.2"  # 2nd node
      - "minio3:10.10.10.3"  # 3rd node
      - "minio4:10.10.10.4"  # 4th node
    volumes:
      - /opt/docker/minio/data:/data
    healthcheck:
      test: [ "CMD", "curl", "-f", "http://localhost:9000/minio/health/live" ]
      interval: 30s
      timeout: 20s
      retries: 3