minio集群docker部署
一、社区版给的方案
1、docker-compose.yaml下载地址:https://raw.githubusercontent.com/minio/minio/master/docs/orchestration/docker-compose/docker-compose.yaml
2、改成自己的后
version: '3' x-minio-common: &minio-common image: quay.io/minio/minio:RELEASE.2023-03-24T21-41-23Z restart: always environment: - MINIO_ROOT_USER=admin - MINIO_ROOT_PASSWORD=abcd1234 privileged: true command: server --console-address ":9001" http://xbd-minio-{1...4}/data-{1...2} healthcheck: test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] interval: 30s timeout: 20s retries: 3 services: xbd-minio-1: <<: *minio-common container_name: xbd-minio-1 ports: - 9001:9001 volumes: - ./1/data-1:/data-1 - ./1/data-2:/data-2 xbd-minio-2: <<: *minio-common container_name: xbd-minio-2 ports: - 9002:9001 volumes: - ./2/data-1:/data-1 - ./2/data-2:/data-2 xbd-minio-3: <<: *minio-common container_name: xbd-minio-3 ports: - 9003:9001 volumes: - ./3/data-1:/data-1 - ./3/data-2:/data-2 xbd-minio-4: <<: *minio-common container_name: xbd-minio-4 ports: - 9004:9001 volumes: - ./4/data-1:/data-1 - ./4/data-2:/data-2
二、bitnami提供的minio
1、注意需要目录权限,改成777即可
2、配置方式
version: '3' x-minio-common: &minio-common image: bitnami/minio:2023 restart: always environment: - MINIO_ROOT_USER=admin - MINIO_ROOT_PASSWORD=abcd1234 - MINIO_DISTRIBUTED_MODE_ENABLED=yes - MINIO_DISTRIBUTED_NODES=xbd-minio-{1...4}/data-{1...2} - MINIO_SKIP_CLIENT=yes privileged: true services: xbd-minio-1: <<: *minio-common container_name: xbd-minio-1 ports: - 9001:9001 volumes: - ./1/data-1:/data-1 - ./1/data-2:/data-2 xbd-minio-2: <<: *minio-common container_name: xbd-minio-2 ports: - 9002:9001 volumes: - ./2/data-1:/data-1 - ./2/data-2:/data-2 xbd-minio-3: <<: *minio-common container_name: xbd-minio-3 ports: - 9003:9001 volumes: - ./3/data-1:/data-1 - ./3/data-2:/data-2 xbd-minio-4: <<: *minio-common container_name: xbd-minio-4 ports: - 9004:9001 volumes: - ./4/data-1:/data-1 - ./4/data-2:/data-2
三、为了加入统一访问入口,可以加入nginx的代理
version: '3' x-minio-common: &minio-common image: quay.io/minio/minio:RELEASE.2023-03-24T21-41-23Z restart: always environment: - MINIO_ROOT_USER=admin - MINIO_ROOT_PASSWORD=abcd1234 privileged: true command: server --console-address ":9001" http://xbd-minio-{1...4}/data-{1...2} healthcheck: test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] interval: 30s timeout: 20s retries: 3 services: xbd-minio-1: <<: *minio-common container_name: xbd-minio-1 volumes: - ./1/data-1:/data-1 - ./1/data-2:/data-2 xbd-minio-2: <<: *minio-common container_name: xbd-minio-2 volumes: - ./2/data-1:/data-1 - ./2/data-2:/data-2 xbd-minio-3: <<: *minio-common container_name: xbd-minio-3 volumes: - ./3/data-1:/data-1 - ./3/data-2:/data-2 xbd-minio-4: <<: *minio-common container_name: xbd-minio-4 volumes: - ./4/data-1:/data-1 - ./4/data-2:/data-2 xbd-nginx: image: nginx:1.22.1-alpine container_name: xbd-nginx ports: - 9000:9000 - 9001:9001 volumes: - ./nginx/nginx.conf:/etc/nginx/nginx.conf restart: always privileged: true
nginx.conf
events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; upstream xbd-minio-endpoint { server xbd-minio-1:9000; server xbd-minio-2:9000; server xbd-minio-3:9000; server xbd-minio-4:9000; } upstream xbd-minio-console { server xbd-minio-1:9001; server xbd-minio-2:9001; server xbd-minio-3:9001; server xbd-minio-4:9001; } server { listen 9000; server_name xbd-minio-endpoint; location / { proxy_pass http://xbd-minio-endpoint; } } server { listen 9001; server_name xbd-minio-console; location / { proxy_pass http://xbd-minio-console; } } }
四、测试