MinIO Cluster Deployment
- Each MinIO node needs to install Docker in advance.
Initialize Docker Swarm Environment
-
Execute the swarm initialization command on the first node, MinIO Node01.
docker swarm init
# The initialization command will output a join command that needs to be run on the other three nodes.
# When there are multiple IP addresses on the server, you can specify the IP and port for other nodes to connect to the current manager node using the --advertise-addr parameter.
# docker swarm init --advertise-addr 192.168.1.11 -
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, you can view it on MinIO Node01 with the following command:
# docker swarm join-token worker -
View the nodes and record each node ID.
docker node ls
Deploy MinIO Cluster
All the following steps need to be performed on all four servers
-
Download the image
- Server with Internet Access
- Server without Internet Access
docker pull registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-minio:RELEASE.2025-04-22T22-12-26Z# Offline image package download link, please download and upload to the deployment server
https://pdpublic.mingdao.com/private-deployment/offline/mingdaoyun-minio-linux-amd64-RELEASE.2025-04-22T22-12-26Z.tar.gz
# Load the offline image on the server using the docker load -i command
docker load -i mingdaoyun-minio-linux-amd64-RELEASE.2025-04-22T22-12-26Z.tar.gz -
Create a data storage directory
mkdir -p /data/minio/volume
The following steps need to be performed only on the first node, MinIO Node01
-
Create a configuration file storage directory
mkdir -p /usr/local/minio -
Create the MinIO configuration file
cat > /usr/local/minio/minio.yaml <<'EOF'
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" # Access port for MinIO console, uncomment if needed
command: minio server http://minio{1...4}/data/storage/data --console-address ":9001"
deploy:
placement:
constraints:
- node.id == xxxxxxxxxxxxxxxx # 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 # 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 # 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 # Docker node.id value of MinIO Node04
EOF- The access key for the object storage is specified by the
MINIO_ROOT_USERenvironment variable. This is a core credential, and a strong password should be used during deployment. - The secret key for the object storage is specified by the
MINIO_ROOT_PASSWORDenvironment variable. This is a critical security key, and a strong password should be used during deployment.
- The access key for the object storage is specified by the
-
Configure start and stop scripts
cat > /usr/local/minio/start.sh <<'EOF'
docker stack deploy -c /usr/local/minio/minio.yaml minio --detach=false
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 -
Start the MinIO service
bash /usr/local/minio/start.sh -
Check the status of each MinIO node
docker stack ps minio