Complete infrastructure with two MinIO instances: one for data storage, the other for service discovery (registry).
┌─────────────────────────────────────────────────────────────┐
│ 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 │
└─────────┘ └─────────┘
docker compose up -dWait a few seconds for the buckets to be created automatically.
-
MinIO Storage Console: http://localhost:9001
- Username:
minioadmin - Password:
minioadmin123 - Bucket:
data
- Username:
-
MinIO Discovery Console: http://localhost:9003
- Username:
minioadmin - Password:
minioadmin123 - Bucket:
registry
- Username:
cd sender
cargo runThe 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
cd receiver
cargo runThe receiver will:
- Discover active senders from MinIO Discovery
- Display their information (ID, endpoint, IP, heartbeat)
- Read data from MinIO Storage
- Refresh every 15 seconds
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
Stores business data sent by senders.
Structure:
data/
└── {sender_id}/
├── data_1.txt
├── data_2.txt
└── ...
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"
}- Registration: Creates a JSON file in
registry/senders/ - Heartbeat: Updates
last_heartbeatevery 10 seconds - Data: Sends files to
data/{sender_id}/
- Discovery: Lists all files in
registry/senders/ - Parsing: Deserializes sender information
- Reading: Retrieves data from
data/{sender_id}/
docker compose downdocker compose down -vdocker compose logs -fcd sender && cargo build --release
cd receiver && cargo build --releasecurl http://localhost:9000/minio/health/live # Storage
curl http://localhost:9002/minio/health/live # Discovery# Terminal 1
cd sender && cargo run
# Terminal 2
cd sender && cargo runEach sender will have a unique ID and appear in the receiver.
# List registered senders
curl -u minioadmin:minioadmin123 \
http://localhost:9002/registry/?list-type=2&prefix=senders/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.
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