Enterprise Cluster
Scale without limits. MynaDB Enterprise Edition transforms the standalone database into a distributed, horizontally-scalable cluster with compute-storage separation. Add nodes on demand, scale to petabytes, and achieve 11-nines durability with S3-based storage.
Architecture Overview
Clients (HTTP / Flight / MySQL)
│
▼
┌───────────────────┐
│ Load Balancer │
└─────────┬─────────┘
│
┌─────────────────────────┼─────────────────────────┐
│ │ │
▼ ▼ ▼
┌────────────────┐ ┌────────────────┐ ┌────────────────┐
│ Router Node 1 │ │ Router Node 2 │ │ Router Node N │
│ HTTP:7000 │ │ (Stateless) │ │ (Stateless) │
│ Flight:7001 │ │ ShardCache │ │ ShardCache │
│ MySQL:7002 │ │ QueryCoord │ │ QueryCoord │
└──────┬─────────┘ └──────┬─────────┘ └──────┬─────────┘
│ Arrow Flight │ │
├────────────────────────┼────────────────────────┘
│ │
▼ ▼
┌────────────────┐ ┌────────────────┐
│ Data Node 1 │ │ Data Node N │ ┌────────────────┐
│ HTTP:5000 │ │ (Scaled-out) │ │ Admin Console │
│ Flight:5001 │ │ DataCache │ │ HTTP:18080 │
│ DataCache │ │ WAL + Parquet │ │ Cluster Mgmt │
│ WAL + Parquet │ │ Compaction │ │ SQL Editor │
└──────┬─────────┘ └──────┬─────────┘ └──────┬─────────┘
│ │ │
└────────────┬───────────┘ │
▼ │
┌──────────────────────────────────────────────────┐ │
│ SHARED OBJECT STORAGE │ │
│ (S3 / MinIO / OSS) │ │
└──────────────────────────────────────────────────┘ │
│
┌──────────────────────────────────────────────────┐ │
│ META SERVICE (Raft Consensus) │◄──────┘
│ ┌────────┐ ┌────────┐ ┌────────┐ │
│ │ Meta 1 │ │ Meta 2 │ │ Meta 3 │ │
│ │ Leader │ │Follower│ │Follower│ │
│ │ :6000 │ │ :6100 │ │ :6200 │ │
│ └────────┘ └────────┘ └────────┘ │
│ Metadata • Table Routing • Locks • Events │
└──────────────────────────────────────────────────┘
Key Benefits
Auto-Scaling
Add or remove compute nodes without data migration. Scale from 3 to 100+ nodes seamlessly.
11-Nines Durability
S3 object storage provides 99.999999999% durability. Your data is safe.
Cost Efficient
Single data copy in cheap object storage. No replication overhead.
Instant Failover
Stateless nodes mean instant recovery. No leader election delays.
Node Types
Meta Nodes
Raft-based consensus service (OpenRaft 0.9). Manages metadata, table routing, distributed locks, leader election, and event streaming. Deploy 3 or 5 nodes.
Ports: HTTP 6000, gRPC 6001
Router Nodes
Stateless request routers with table-level routing via ShardCache. Client-facing HTTP, Arrow Flight, and MySQL wire protocol. Fan-out query coordination.
Ports: HTTP 7000, Flight 7001, MySQL 7002
Data Nodes
Storage and query execution engines. Accept writes into DataCache, flush to Parquet on S3, run LSM compaction, and execute SQL queries locally via DataFusion.
Ports: HTTP 5000, Flight 5001
Admin Console
Optional web-based management UI. Connects to Meta for node discovery, provides SQL editor, storage browser, and cluster monitoring dashboards.
Port: HTTP 18080
How It Works
Table-Level Routing
MynaDB uses table-level routing for optimal performance in time-series workloads. Each table is owned by a specific Data node, with ownership tracked in the Meta service. This provides 600x fewer metadata entries than file-level routing while maintaining excellent cache locality.
Write Path
1. Client → POST /write/:db (to Router)
2. Router parses line protocol, extracts table name
3. Router looks up table owner in ShardCache
4. Router sends RecordBatch to Data node via Arrow Flight
5. Data node inserts into DataCache (in-memory)
6. Data node registers table with Meta (if new)
7. Background: DataCache flushes to Parquet on S3 every 60s
8. Background: Compactor merges Parquet files (L0 → L1 → L2)
Query Path
1. Client → GET /query/:db?sql=... (to Router)
2. Router parses SQL, extracts table references
3. Router determines target Data nodes from ShardCache
4. Router fans out query to Data nodes in parallel (Arrow Flight)
5. Each Data node executes locally:
- Check DataCache for hot data
- Read matching Parquet files from S3
- Apply partition pruning + predicate pushdown
6. Router aggregates partial results
7. Return combined result to client
Failure Recovery
Data nodes send heartbeats every 5 seconds with a 15-second lease TTL. When a node crashes, the Meta leader detects the expired lease, marks the node as Inactive, and triggers the recovery manager. Orphaned tables are reassigned to healthy nodes, and Router ShardCaches are updated via events. Optional cold standby nodes can flush in-flight data to S3 before failover.
Configuration
[cluster]
enabled = true
node_id = "" # Auto-generated if empty
advertise_addr = "0.0.0.0:7000"
role = "hybrid" # "compute", "compactor", "hybrid"
[cluster.coordinator]
type = "etcd"
endpoints = ["etcd-1:2379", "etcd-2:2379", "etcd-3:2379"]
lock_prefix = "/mynadb/locks/"
lock_ttl_secs = 30
heartbeat_interval_secs = 5
[cluster.cache]
invalidation_channel = "/mynadb/cache/invalidate"
[cluster.compaction]
leader_only = true
election_key = "/mynadb/leader/compactor"
[cluster.health]
check_interval_secs = 10
unhealthy_threshold = 3
Cluster API
| Endpoint | Method | Description |
|---|---|---|
/cluster/status |
GET | Overall cluster status and this node's info |
/cluster/nodes |
GET | List all registered nodes |
/cluster/leader |
GET | Current leader information |
/cluster/health |
GET | Cluster health check |
/cluster/drain?node_id=xxx |
POST | Drain a node (prepare for removal) |
/cluster/remove?node_id=xxx |
DELETE | Remove a node from the cluster |
Example: Cluster Status
curl http://localhost:7000/cluster/status
{
"enabled": true,
"node_id": "mynadb-1",
"role": "hybrid",
"state": "active",
"is_leader": true,
"leader_id": "mynadb-1",
"total_nodes": 3,
"healthy_nodes": 3,
"coordinator_type": "etcd",
"coordinator_connected": true
}
Deployment
Kubernetes
# Create namespace
kubectl create namespace mynadb
# Apply manifests
kubectl apply -f deploy/kubernetes/configmap.yaml
kubectl apply -f deploy/kubernetes/service.yaml
kubectl apply -f deploy/kubernetes/deployment.yaml
kubectl apply -f deploy/kubernetes/hpa.yaml
# Check status
kubectl get pods -n mynadb
kubectl get svc -n mynadb
Docker Compose
# Start cluster with etcd and MinIO
docker-compose -f deploy/docker-compose.cluster.yaml up -d
# Verify nodes
curl http://localhost:7000/cluster/nodes
# Write to node 1
curl -X POST http://localhost:7000/write/testdb \
-d "cpu,host=a value=1"
# Query from node 2 (port 7010)
curl http://localhost:7010/query/testdb \
-d "SELECT * FROM cpu"
# Check HAProxy stats
open http://localhost:8404/stats
Metrics
Prometheus metrics are available at /metrics:
| Metric | Type | Description |
|---|---|---|
mynadb_cluster_nodes_total |
Gauge | Total number of nodes |
mynadb_cluster_nodes_healthy |
Gauge | Number of healthy nodes |
mynadb_cluster_is_leader |
Gauge | 1 if this node is leader |
mynadb_cluster_lock_acquisitions_total |
Counter | Lock acquisition count |
mynadb_cluster_cache_invalidations_total |
Counter | Cache invalidations sent |
Performance
| Metric | Standalone | Cluster (cache hit) | Cluster (cache miss) |
|---|---|---|---|
| Write Latency (p50) | 5-10ms | 10-30ms | 50-100ms |
| Write Latency (p99) | 20-50ms | 50-100ms | 150-300ms |
| Query Latency (p50) | 10-50ms | 10-50ms | 100-300ms |
| Write Throughput | 100K pts/s | 100K pts/s/node | - |
Comparison
| Feature | MynaDB Cluster | Shared-Nothing (Raft) | Master-Slave |
|---|---|---|---|
| Complexity | Medium | Very High | Low |
| Auto-scaling | Excellent | Hard (rebalancing) | None |
| Durability | S3 (11 nines) | Raft quorum | Replication lag |
| Failover time | Instant | 10-15s | 10-30s |
| Best for | Cloud, elastic | On-prem, strong consistency | Simple HA |
Deep Dive
Cluster Getting Started
Step-by-step guide to building, configuring, and starting a local development cluster with all node types.
Cluster Architecture
Deep dive into Meta (Raft), Router (ShardCache), Data (storage/query), and Admin node internals.
Cluster Scaling
Scale-out/scale-in operations, node lifecycle, failover detection, cold standby replication.