MinIO is a high-performance, distributed object storage system that is compatible with Amazon S3 APIs. This guide will help you set up a MinIO cluster on Raspberry Pi 4 devices running Ubuntu, with storage on USB drives. By the end of this guide, you'll have a functional, resilient storage solution suitable for small-scale projects or personal use.
- Ubuntu Installed on each Raspberry Pi.
- Static IP Addresses for each Raspberry Pi:
192.168.0.81
192.168.0.82
192.168.0.83
192.168.0.84
- USB Drives connected and mounted on each Raspberry Pi.
-
Update Package Lists:
sudo apt update && sudo apt upgrade -y
-
Install Dependencies:
sudo apt install -y wget unzip
-
Identify USB Drive:
sudo fdisk -l
Example output:
Disk /dev/sda: 29.32 GiB, 31482445824 bytes, 61489152 sectors Disk model: Cruzer Fit Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: gpt Disk identifier: 2A93212D-ABD4-486B-B063-B021BCA2C9FB
-
Create a Mount Point:
sudo mkdir -p /mnt/minio
-
Mount the USB Drive: Replace
/dev/sda1
with your actual USB drive identifier.sudo mount /dev/sda /mnt/minio
-
OPTIONAL: Format the Drive if Necessary: Replace
/dev/sda1
with your actual USB drive identifier.sudo umount /dev/sda sudo mkfs.ext4 /dev/sda sudo mkdir -p /mnt/minio sudo mount /dev/sda /mnt/minio
-
Ensure USB Drive Mounts on Boot: Add the following line to
/etc/fstab
:sudo nano /etc/fstab
Add this line to the file:
/dev/sda /mnt/minio ext4 defaults 0 0
-
Download MinIO:
wget https://dl.min.io/server/minio/release/linux-arm64/minio
-
Make MinIO Executable:
chmod +x minio
-
Move MinIO to
/usr/local/bin/
:sudo mv minio /usr/local/bin/
-
Start MinIO on Each Raspberry Pi:
minio server http://192.168.0.81/mnt/minio http://192.168.0.82/mnt/minio http://192.168.0.83/mnt/minio http://192.168.0.84/mnt/minio
-
Create a Systemd Service (Optional): Create a service file at
/etc/systemd/system/minio.service
with the following content:[Unit] Description=MinIO Documentation=https://docs.min.io Wants=network-online.target After=network-online.target [Service] User=root Group=root ExecStart=/usr/local/bin/minio server http://192.168.0.81/mnt/minio/data http://192.168.0.82/mnt/minio/data http://192.168.0.83/mnt/minio/data http://192.168.0.84/mnt/minio/data Restart=always Environment=<MINIO_ACCESS_KEY> Environment=<MINIO_SECRET_KEY> EnvironmentFile=-/etc/default/minio LimitNOFILE=65536 [Install] WantedBy=multi-user.target
-
Enable and Start the Service:
sudo systemctl daemon-reload sudo systemctl enable minio sudo systemctl start minio
-
Install the MinIO Client
wget https://dl.min.io/client/mc/release/linux-arm64/mc sudo chmod +x mc sudo mv mc /usr/local/bin/
Configure the MinIO Client (mc):
mc alias set minisync http://192.168.0.81:9000 <MINIO_ACCESS_KEY> <MINIO_SECRET_KEY>
Added `minisync` successfully.
Add bucket for minisync go application:
mc mb minisync/minisync
- Open your browser and navigate to
http://192.168.0.81:9000
. - Log in using your MinIO access key and secret key.
mc mb minisync/mybucket
mc ls minisync
mc rb minisync/mybucket
mc cp /path/to/file minisync/mybucket
mc cp minisync/mybucket/file /path/to/destination
-
Remove an Object:
mc rm minisync/mybucket/file
-
Remove All Objects from a Bucket:
mc rm --recursive --force minisync/mybucket
-
Move an Object:
mc mv minisync/mybucket/sourcefile minisync/mybucket/destinationfile
-
Copy an Object:
mc cp minisync/mybucket/sourcefile minisync/mybucket/destinationfile
-
Create a New User:
mc admin user add minisync newuser newuserpassword
-
Disable a User:
mc admin user disable minisync newuser
-
Enable a User:
mc admin user enable minisync newuser
-
Remove a User:
mc admin user remove minisync newuser
-
Add a Policy to a User:
mc admin policy set minisync readwrite user=newuser
-
List All Policies:
mc admin policy list minisync
-
Create a Custom Policy:
mc admin policy add minisync custompolicy /path/to/policy.json
-
Check Server Status:
mc admin info minisync
-
Monitor Server Logs:
mc admin log minisync
-
Check Server Health:
mc admin health minisync
-
View Bucket Usage:
mc du minisync/mybucket
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:PutObject"
],
"Resource": [
"arn:aws:s3:::mybucket/*"
]
}
]
}
-
MinIO Server Fails to Start:
- Ensure all Raspberry Pi devices have consistent system time and are reachable over the network.
- Check that the USB drives are correctly mounted and accessible.
-
Unable to Access MinIO Web Interface:
- Verify that the correct port is open and that the MinIO server is running.
You have successfully set up a MinIO cluster on your Raspberry Pi devices. Your cluster is now ready to store and manage your data with high availability and resilience. Next, consider setting up regular backups, monitoring the health of your cluster, and exploring MinIO's advanced features.