...
Endpoint:
DELETE /api/files/delete/{filename}
Headers: None
Response: Confirmation message.
...
Enhanced Lab: Demonstrating Advanced MinIO Features
...
1. Erasure Coding
Erasure coding protects data from drive failures by splitting and storing data across multiple drives.
Steps:
Modify the Docker setup to enable erasure coding:
Code Block docker run -p 9000:9000 -p 9001:9001 \ -e "MINIO_ROOT_USER=YOUR_ACCESS_KEY" \ -e "MINIO_ROOT_PASSWORD=YOUR_SECRET_KEY" \ --name minio \ -v /mnt/disk1:/data1 \ -v /mnt/disk2:/data2 \ -v /mnt/disk3:/data3 \ -v /mnt/disk4:/data4 \ minio/minio server /data{1...4}
Simulate a disk failure by stopping one volume:
Code Block docker stop /mnt/disk1
Test file uploads/downloads using the existing Spring Boot APIs to observe no data loss.
...
2. Bitrot Protection
MinIO uses checksums to detect and repair corrupted data.
Steps:
Upload a file through the Spring Boot API.
Manually corrupt the uploaded file in the backend storage.
Code Block echo "corruption" >> /mnt/disk1/mybucket/uploaded-file.txt
Run the MinIO heal command:
Code Block mc admin heal start --recursive local
Verify the integrity of the file using the API.
...
3. Encryption
Enable server-side encryption for data protection.
Configuration:
Add encryption configuration in MinIO:
Code Block export MINIO_KMS_MASTER_KEY=my-minio-key:32-CHARACTER-LONG-KEY
Update the Spring Boot application to encrypt files on upload:
Code Block minioClient.putObject( PutObjectArgs.builder() .bucket(bucketName) .object(fileName) .stream(file.getInputStream(), file.getSize(), -1) .contentType(file.getContentType()) .headers(Map.of("X-Amz-Server-Side-Encryption", "AES256")) .build() );
Verify files are stored in encrypted format by examining backend storage.
...
4. Continuous Replication
Replicate data to another MinIO server.
Setup:
Start a second MinIO instance:
Code Block docker run -p 9100:9000 -p 9101:9001 \ -e "MINIO_ROOT_USER=REPL_ACCESS_KEY" \ -e "MINIO_ROOT_PASSWORD=REPL_SECRET_KEY" \ --name minio-replica \ -v /mnt/replica:/data \ minio/minio server /data
Configure replication between the primary and replica servers:
Code Block mc alias set source http://localhost:9000 ACCESS_KEY SECRET_KEY mc alias set target http://localhost:9100 REPL_ACCESS_KEY REPL_SECRET_KEY mc admin bucket replication set source/mybucket --replica=target/mybucket
Test replication by uploading files to the primary bucket and verifying their presence on the replica.
...
5. Global Federation
Federate MinIO servers across regions into a single namespace.
Setup:
Deploy two MinIO instances in different regions.
Configure federation in the MinIO console by linking the servers under a unified namespace.
Use the Spring Boot APIs to interact with the federated namespace.
...
6. Multi-Cloud Gateway
Use MinIO as a gateway to AWS S3 or another cloud provider.
Steps:
Configure MinIO as an S3 gateway:
Code Block docker run -p 9000:9000 -p 9001:9001 \ -e "MINIO_ACCESS_KEY=AWS_ACCESS_KEY" \ -e "MINIO_SECRET_KEY=AWS_SECRET_KEY" \ minio/minio gateway s3
Update the Spring Boot configuration to interact with the gateway endpoint.
Test the gateway by uploading and downloading files through Spring Boot APIs.
...
Exercises
Erasure Coding Recovery: Test uploading files during a simulated disk failure and confirm data recovery.
Corruption Simulation: Introduce bitrot and validate repair using MinIO healing commands.
Replication Failover: Test failover between replicated servers during primary server downtime.
Federated Operations: Perform CRUD operations on the federated namespace and verify data availability across regions.
Multi-Cloud Gateway Usage: Test MinIO as a gateway to AWS S3 by uploading and accessing files.