Question
How do I configure MinIO to run in high availability (HA) mode to ensure my object storage is resilient to node failures and provides continuous service availability?
Answer
MinIO achieves high availability through its distributed architecture with erasure coding. Here’s a comprehensive guide to setting up MinIO in HA mode:
Prerequisites
- Minimum 4 drives across multiple nodes (for basic HA)
- Even number of drives for optimal erasure coding efficiency
- Network connectivity between all nodes
- Time synchronization (NTP) across all nodes
- DNS resolution or proper
/etc/hostsconfiguration
1. Planning Your HA Setup
Recommended Configurations
Small HA Setup (4 nodes):
4 nodes × 4 drives = 16 drives totalErasure Coding: EC:2 (2 parity drives per erasure set)Fault Tolerance: 2 drive failuresMedium HA Setup (8 nodes):
8 nodes × 8 drives = 64 drives totalErasure Coding: EC:4 (4 parity drives per erasure set)Fault Tolerance: 4 drive failuresLarge HA Setup (16 nodes):
16 nodes × 16 drives = 256 drives totalErasure Coding: EC:8 (8 parity drives per erasure set)Fault Tolerance: 8 drive failures2. Server Configuration
Hardware Requirements
- CPU: 4+ cores per node
- RAM: 8GB+ per node (more for larger deployments)
- Storage: Fast SSDs or enterprise HDDs
- Network: 10Gbps+ for production workloads
Operating System Setup
# On each node, configure hostnamesudo hostnamectl set-hostname minio-node-1 # Adjust for each node
# Update /etc/hosts on all nodescat >> /etc/hosts << EOF10.0.1.11 minio-node-110.0.1.12 minio-node-210.0.1.13 minio-node-310.0.1.14 minio-node-4EOF
# Install NTP for time synchronizationsudo apt update && sudo apt install -y ntpsudo systemctl enable ntp && sudo systemctl start ntp3. MinIO Binary Installation
# Download MinIO server binarywget https://dl.min.io/server/minio/release/linux-amd64/miniochmod +x miniosudo mv minio /usr/local/bin/
# Create MinIO user and directoriessudo useradd -r minio-user -s /sbin/nologinsudo mkdir -p /opt/miniosudo mkdir -p /etc/miniosudo mkdir -p /var/log/miniosudo chown minio-user:minio-user /opt/minio /var/log/minio4. Distributed Configuration
Environment Configuration
Create /etc/minio/minio.conf on all nodes:
# MinIO ConfigurationMINIO_ROOT_USER=minioadminMINIO_ROOT_PASSWORD=minio123456789 # Change this!
# Distributed setup endpointsMINIO_OPTS="--console-address :9001"
# For 4-node setup with 4 drives per nodeMINIO_VOLUMES="http://minio-node-{1...4}/opt/minio/data{1...4}"
# Alternative: Direct IP addresses# MINIO_VOLUMES="http://10.0.1.11/opt/minio/data{1...4} http://10.0.1.12/opt/minio/data{1...4} http://10.0.1.13/opt/minio/data{1...4} http://10.0.1.14/opt/minio/data{1...4}"
# TLS Configuration (recommended for production)# MINIO_SERVER_URL="https://minio.example.com"# MINIO_BROWSER_REDIRECT_URL="https://console.minio.example.com"Systemd Service Configuration
Create /etc/systemd/system/minio.service:
[Unit]Description=MinIO Object Storage ServerDocumentation=https://min.io/docs/minio/linux/index.htmlWants=network-online.targetAfter=network-online.targetAssertFileIsExecutable=/usr/local/bin/minio
[Service]WorkingDirectory=/usr/local/
User=minio-userGroup=minio-userProtectProc=invisible
EnvironmentFile=-/etc/minio/minio.confExecStartPre=/bin/bash -c "if [ -z \"${MINIO_VOLUMES}\" ]; then echo \"Variable MINIO_VOLUMES not set in /etc/minio/minio.conf\"; exit 1; fi"ExecStart=/usr/local/bin/minio server $MINIO_OPTS $MINIO_VOLUMES
# Let systemd restart this service alwaysRestart=always
# Specifies the maximum file descriptor number that can be opened by this processLimitNOFILE=1048576
# Specifies the maximum number of threads this process can createTasksMax=infinity
# Disable timeout logic and wait until process is stoppedTimeoutStopSec=infinitySendSIGKILL=no
[Install]WantedBy=multi-user.target5. Storage Preparation
On each node, prepare the storage drives:
# Format drives (adjust device paths)sudo mkfs.xfs /dev/sdb -fsudo mkfs.xfs /dev/sdc -fsudo mkfs.xfs /dev/sdd -fsudo mkfs.xfs /dev/sde -f
# Create mount pointssudo mkdir -p /opt/minio/data{1..4}
# Add to /etc/fstab for persistent mountingcat >> /etc/fstab << EOF/dev/sdb /opt/minio/data1 xfs defaults,noatime 0 2/dev/sdc /opt/minio/data2 xfs defaults,noatime 0 2/dev/sdd /opt/minio/data3 xfs defaults,noatime 0 2/dev/sde /opt/minio/data4 xfs defaults,noatime 0 2EOF
# Mount all drivessudo mount -a
# Set permissionssudo chown -R minio-user:minio-user /opt/minio/6. Starting the Cluster
Start MinIO on all nodes simultaneously:
# Enable and start on all nodessudo systemctl daemon-reloadsudo systemctl enable miniosudo systemctl start minio
# Check statussudo systemctl status miniosudo journalctl -u minio -f7. Load Balancer Configuration
Using HAProxy
global daemon maxconn 4096
defaults mode http timeout connect 5000ms timeout client 50000ms timeout server 50000ms
# MinIO API Load Balancerfrontend minio_api bind *:9000 default_backend minio_servers
backend minio_servers balance roundrobin option httpchk GET /minio/health/live server minio1 minio-node-1:9000 check server minio2 minio-node-2:9000 check server minio3 minio-node-3:9000 check server minio4 minio-node-4:9000 check
# MinIO Console Load Balancerfrontend minio_console bind *:9001 default_backend minio_console_servers
backend minio_console_servers balance roundrobin server console1 minio-node-1:9001 check server console2 minio-node-2:9001 check server console3 minio-node-3:9001 check server console4 minio-node-4:9001 checkUsing Nginx
upstream minio_servers { server minio-node-1:9000; server minio-node-2:9000; server minio-node-3:9000; server minio-node-4:9000;}
upstream minio_console { server minio-node-1:9001; server minio-node-2:9001; server minio-node-3:9001; server minio-node-4:9001;}
server { listen 80; server_name minio.example.com;
# MinIO API location / { proxy_pass http://minio_servers; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_connect_timeout 300; proxy_http_version 1.1; proxy_set_header Connection ""; chunked_transfer_encoding off; }}
server { listen 80; server_name console.minio.example.com;
# MinIO Console location / { proxy_pass http://minio_console; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; }}8. Verification and Testing
Cluster Health Check
# Using MinIO clientmc admin info myminio
# Check server statuscurl http://minio.example.com:9000/minio/health/live
# Detailed cluster infomc admin info myminio --jsonFailover Testing
# Stop one node to test failoversudo systemctl stop minio
# Verify cluster still respondsmc ls myminio/
# Test file upload/downloadmc cp test-file.txt myminio/test-bucket/mc cp myminio/test-bucket/test-file.txt downloaded-file.txt
# Restart the stopped nodesudo systemctl start minio9. Production Best Practices
Security
- Enable TLS for all communications
- Use strong passwords and rotate regularly
- Implement IAM policies for access control
- Enable audit logging for compliance
Monitoring
- Set up Prometheus metrics endpoint
- Configure alerts for drive failures
- Monitor disk space and performance
- Track API response times
Backup Strategy
- Configure replication to remote sites
- Implement bucket versioning for data protection
- Set up lifecycle policies for cost optimization
- Regular backup verification and restore testing
Common Issues and Troubleshooting
- Clock Synchronization: Ensure all nodes have synchronized time using NTP
- Network Connectivity: Verify all nodes can communicate on required ports
- Disk Space: Monitor available space and add drives before reaching capacity
- Load Balancer Health Checks: Configure proper health check endpoints
- Erasure Set Distribution: Ensure drives are evenly distributed across failure domains
Related Questions
This HA configuration provides resilience against node and drive failures while maintaining high performance for your object storage workloads.