Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • 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:

  1. 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}
  2. Simulate a disk failure by stopping one volume:

    Code Block
    docker stop /mnt/disk1
  3. 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:

  1. Upload a file through the Spring Boot API.

  2. Manually corrupt the uploaded file in the backend storage.

    Code Block
    echo "corruption" >> /mnt/disk1/mybucket/uploaded-file.txt
  3. 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:

  1. Add encryption configuration in MinIO:

    Code Block
    export MINIO_KMS_MASTER_KEY=my-minio-key:32-CHARACTER-LONG-KEY

  2. 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() );
  3. Verify files are stored in encrypted format by examining backend storage.

...

4. Continuous Replication

Replicate data to another MinIO server.

Setup:

  1. 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
  2. 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
  3. 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:

  1. Deploy two MinIO instances in different regions.

  2. Configure federation in the MinIO console by linking the servers under a unified namespace.

  3. 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:

  1. 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
  2. Update the Spring Boot configuration to interact with the gateway endpoint.

  3. Test the gateway by uploading and downloading files through Spring Boot APIs.

...

Exercises

  1. Erasure Coding Recovery: Test uploading files during a simulated disk failure and confirm data recovery.

  2. Corruption Simulation: Introduce bitrot and validate repair using MinIO healing commands.

  3. Replication Failover: Test failover between replicated servers during primary server downtime.

  4. Federated Operations: Perform CRUD operations on the federated namespace and verify data availability across regions.

  5. Multi-Cloud Gateway Usage: Test MinIO as a gateway to AWS S3 by uploading and accessing files.