Getting Started with MinIO: Installation, Configuration, and Spring Boot Integration for Object Storage
This tutorial introduces MinIO, an open‑source object storage solution, explains its features and application scenarios, provides step‑by‑step Docker installation, shows how to configure it, and demonstrates integrating MinIO with Spring Boot to upload files via SDK.
This article introduces MinIO, an open‑source object storage suite written in Go, compatible with Amazon S3 and Azure APIs, and suitable for private cloud or gateway scenarios.
What is MinIO?
MinIO is a lightweight, high‑performance storage system that supports objects up to 5 TB and offers cloud‑native features such as containerization and Kubernetes orchestration.
Application Scenarios
It can be used as a private‑cloud object store or as a gateway layer that seamlessly connects to Amazon S3 or Microsoft Azure services.
Key Features
High performance: read/write speeds up to 55Gb/s and 35Gb/s on standard hardware.
Scalable: clusters can form federations with a global namespace across data centers.
Cloud‑native: containerized, Kubernetes‑orchestrated, multi‑tenant.
Amazon S3 compatible: supports S3 v2/v4 APIs, MinIO SDK, MinIO Client, AWS SDK and CLI.
SDK support: Go, Java, Python SDKs are provided.
Graphical UI for management.
Erasure coding and checksum for data integrity, tolerating up to half of the disks failing.
Installation of MinIO
The installation is demonstrated using Docker.
1. Pull the Docker image
docker pull minio/minio2. Run the container
docker run -p 9000:9000 -p 9001:9001 --name minio -d --restart=always -e "MINIO_ACCESS_KEY=admin" -e "MINIO_SECRET_KEY=admin" -v /home/data:/data -v /home/config:/root/.minio minio/minio server --console-address ":9000" --address ":9001" /dataExplanation of the flags: -p 9000: port for the web console. -p 9001: port for the API (used by SDKs). MINIO_ACCESS_KEY and MINIO_SECRET_KEY: credentials for the console.
After starting the container, the web console is reachable at http://<i>ip</i>:9000/login, where a bucket (e.g., test) can be created and set to public.
Spring Boot Integration
MinIO can be accessed from a Spring Boot application via its Java SDK.
1. Add Maven dependency
<dependency>
<groupId>io.minio</groupId>
<artifactId>minio</artifactId>
<version>8.2.1</version>
</dependency>2. Configure connection in application.yml
minio:
# access URL
endpoint: http://192.168.47.148
# API port
port: 9001
# credentials
accessKey: HQGWFYLWGC6FVJ0CQFOG
secretKey: pUGhAgQhZDxJaLmN3uz65YX7Bb3FyLdLglBvcCr1
secure: false
bucket-name: test
image-size: 10485760
file-size: 10737418243. Create an upload controller
/**
* @author 公众号:码猿技术专栏
*/
@RequestMapping("/minio")
@RestController
public class MinioController {
@Autowired
private MinioService minioService;
@PostMapping("/upload")
public String uploadFile(MultipartFile file, String bucketName) {
String fileType = FileTypeUtils.getFileType(file);
if (fileType != null) {
return minioService.putObject(file, bucketName, fileType);
}
return "Unsupported file format. Please verify and re‑upload!";
}
}Calling the /minio/upload endpoint returns a URL that can be opened directly in a browser. The uploaded file appears in the MinIO console, and a shareable link (valid for 7 days) can be generated.
Conclusion
Although MinIO is an open‑source project, it provides powerful features that make it suitable for small‑to‑medium projects as a free object‑storage or image‑hosting solution.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Code Ape Tech Column
Former Ant Group P8 engineer, pure technologist, sharing full‑stack Java, job interview and career advice through a column. Site: java-family.cn
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
