Skip to content

lsoulet/minio-discovery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MinIO Service Discovery Infrastructure

Complete infrastructure with two MinIO instances: one for data storage, the other for service discovery (registry).

Architecture

┌─────────────────────────────────────────────────────────────┐
│                     Infrastructure                          │
├──────────────────────────┬──────────────────────────────────┤
│   MinIO Storage          │   MinIO Discovery                │
│   Ports: 9000/9001       │   Ports: 9002/9003               │
│   Bucket: data           │   Bucket: registry               │
└──────────────────────────┴──────────────────────────────────┘
         ↑                              ↑
         │ 2. Write data                │ 1. Register
         │                              │
    ┌────┴────┐                    ┌────┴────┐
    │ Sender  │                    │ Sender  │
    │  Apps   │                    │  Apps   │
    └─────────┘                    └─────────┘
         ↑                              ↑
         │ 2. Read data                 │ 1. Discover
         │                              │
    ┌────┴────┐                    ┌────┴────┐
    │Receiver │                    │Receiver │
    │  Apps   │                    │  Apps   │
    └─────────┘                    └─────────┘

Quick Start

1. Start the infrastructure

docker compose up -d

Wait a few seconds for the buckets to be created automatically.

2. Verify services

  • MinIO Storage Console: http://localhost:9001

    • Username: minioadmin
    • Password: minioadmin123
    • Bucket: data
  • MinIO Discovery Console: http://localhost:9003

    • Username: minioadmin
    • Password: minioadmin123
    • Bucket: registry

3. Start a Sender application

cd sender
cargo run

The sender will:

  • Generate a unique ID
  • Register itself in MinIO Discovery (registry/senders/{id}.json)
  • Send data periodically to MinIO Storage
  • Update its heartbeat every 10 seconds

4. Start a Receiver application

cd receiver
cargo run

The receiver will:

  • Discover active senders from MinIO Discovery
  • Display their information (ID, endpoint, IP, heartbeat)
  • Read data from MinIO Storage
  • Refresh every 15 seconds

Project Structure

minio-discovery/
├── docker-compose.yml          # Infrastructure (2 MinIO instances)
├── .env                        # Environment configuration
├── .env.example                # Example environment file
├── sender/
│   ├── Cargo.toml             # Rust dependencies (aws-sdk-s3, tokio, serde)
│   └── src/
│       └── main.rs            # Sender application
├── receiver/
│   ├── Cargo.toml             # Rust dependencies (aws-sdk-s3, tokio, serde)
│   └── src/
│       └── main.rs            # Receiver application
└── README.md

Detailed Operation

MinIO Storage (Ports 9000/9001)

Stores business data sent by senders.

Structure:

data/
└── {sender_id}/
    ├── data_1.txt
    ├── data_2.txt
    └── ...

MinIO Discovery (Ports 9002/9003)

Service registry where senders register themselves.

Structure:

registry/
└── senders/
    ├── {sender_id_1}.json
    ├── {sender_id_2}.json
    └── ...

JSON file format:

{
  "sender_id": "uuid-v4",
  "endpoint": "127.0.0.1:8080",
  "ip_address": "127.0.0.1",
  "registered_at": "2026-02-16T12:00:00Z",
  "last_heartbeat": "2026-02-16T12:05:00Z",
  "status": "active"
}

Sender Application

  1. Registration: Creates a JSON file in registry/senders/
  2. Heartbeat: Updates last_heartbeat every 10 seconds
  3. Data: Sends files to data/{sender_id}/

Receiver Application

  1. Discovery: Lists all files in registry/senders/
  2. Parsing: Deserializes sender information
  3. Reading: Retrieves data from data/{sender_id}/

Useful Commands

Stop the infrastructure

docker compose down

Delete data (volumes)

docker compose down -v

View logs

docker compose logs -f

Compile in release mode

cd sender && cargo build --release
cd receiver && cargo build --release

Testing and Verification

Test 1: Verify MinIO instances

curl http://localhost:9000/minio/health/live  # Storage
curl http://localhost:9002/minio/health/live  # Discovery

Test 2: Run multiple senders

# Terminal 1
cd sender && cargo run

# Terminal 2
cd sender && cargo run

Each sender will have a unique ID and appear in the receiver.

Test 3: Verify via MinIO API

# List registered senders
curl -u minioadmin:minioadmin123 \
  http://localhost:9002/registry/?list-type=2&prefix=senders/

Configuration

Applications use environment variables from the .env file. Edit .env to customize:

  • MinIO endpoints and buckets
  • Credentials
  • Heartbeat intervals
  • Sender IP address
  • Discovery refresh interval

See .env.example for all available options.

Troubleshooting

Problem: "Connection refused" when starting applications

Solution: Verify that docker compose is running and buckets are created


Problem: Receivers cannot find senders

Solution: Verify senders are running and check http://localhost:9003 to see the registry bucket


Problem: Rust compilation error

Solution: Make sure Rust is installed (rustup recommended)

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Resources

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages