Skip to main content

MinIO Cluster Deployment

Initialize Docker Swarm Environment

  1. Execute the swarm initialization command on the first node, MinIO Node01.

    docker swarm init

    # After executing the initialization command, a join command will be output, which needs to be run on the other three nodes.
    # If there are multiple IP addresses on the server, use the --advertise-addr parameter to specify the IP and port for other nodes to connect to the current manager node.
    # docker swarm init --advertise-addr 192.168.1.11
  2. Run the join command on MinIO Node02, Node03, and Node04 to join the swarm cluster.

    docker swarm join --token xxxxxxxx

    # If the token is forgotten, it can be viewed on Node01 with the following command:
    # docker swarm join-token worker
  3. View and record the node IDs.

    docker node ls

Deploy MinIO Cluster

The following steps need to be performed on all four servers

  1. Download the image

    docker pull registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-minio:RELEASE.2025-04-22T22-12-26Z
  2. Create a data storage directory

    mkdir -p /data/minio/volume

The following steps need to be performed only on the first node, MinIO Node01

  1. Create a configuration file storage directory

    mkdir -p /usr/local/minio
  2. Create a MinIO configuration file

    version: '3'
    services:
    minio1:
    hostname: minio1
    image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-minio:RELEASE.2025-04-22T22-12-26Z
    environment:
    MINIO_ROOT_USER: "mingdao"
    MINIO_ROOT_PASSWORD: "123456789"
    volumes:
    - /usr/share/zoneinfo/Etc/GMT-8:/etc/localtime
    - /data/minio/volume:/data/storage
    ports:
    - "9011:9000"
    # - "19111:9001" # MinIO console access port, uncomment if needed
    command: minio server http://minio{1...4}/data/storage/data --console-address ":9001"
    deploy:
    placement:
    constraints:
    - node.id == xxxxxxxxxxxxxxxx # The docker node.id value of MinIO Node01


    minio2:
    hostname: minio2
    image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-minio:RELEASE.2025-04-22T22-12-26Z
    environment:
    MINIO_ROOT_USER: "mingdao"
    MINIO_ROOT_PASSWORD: "123456789"
    volumes:
    - /usr/share/zoneinfo/Etc/GMT-8:/etc/localtime
    - /data/minio/volume:/data/storage
    ports:
    - "9012:9000"
    command: minio server http://minio{1...4}/data/storage/data --console-address ":9001"
    deploy:
    placement:
    constraints:
    - node.id == xxxxxxxxxxxxxxxx # The docker node.id value of MinIO Node02

    minio3:
    hostname: minio3
    image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-minio:RELEASE.2025-04-22T22-12-26Z
    environment:
    MINIO_ROOT_USER: "mingdao"
    MINIO_ROOT_PASSWORD: "123456789"
    volumes:
    - /usr/share/zoneinfo/Etc/GMT-8:/etc/localtime
    - /data/minio/volume:/data/storage
    ports:
    - "9013:9000"
    command: minio server http://minio{1...4}/data/storage/data --console-address ":9001"
    deploy:
    placement:
    constraints:
    - node.id == xxxxxxxxxxxxxxxx # The docker node.id value of MinIO Node03

    minio4:
    hostname: minio4
    image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-minio:RELEASE.2025-04-22T22-12-26Z
    environment:
    MINIO_ROOT_USER: "mingdao"
    MINIO_ROOT_PASSWORD: "123456789"
    volumes:
    - /usr/share/zoneinfo/Etc/GMT-8:/etc/localtime
    - /data/minio/volume:/data/storage
    ports:
    - "9014:9000"
    command: minio server http://minio{1...4}/data/storage/data --console-address ":9001"
    deploy:
    placement:
    constraints:
    - node.id == xxxxxxxxxxxxxxxx # The docker node.id value of MinIO Node04
    • The value of the MINIO_ROOT_USER variable is the accessKey for object storage.
    • The value of the MINIO_ROOT_PASSWORD variable is the secretKey for object storage.
  3. Configure start/stop scripts

    cat > /usr/local/minio/start.sh <<EOF
    docker stack deploy -c /usr/local/minio/minio.yaml minio
    EOF

    cat > /usr/local/minio/stop.sh <<EOF
    docker stack rm minio
    EOF

    chmod +x /usr/local/minio/start.sh
    chmod +x /usr/local/minio/stop.sh
  4. Start the MinIO service

    bash /usr/local/minio/start.sh