One binary. Fourteen protocols. Zero infrastructure.
🎯 Alibaba Cloud Full-Stack Compatible 🚀 14 Database Protocols in One Binary ⚡ 97% Test Pass Rate (180/185)
English · 中文文档 · Quick Start · Protocols · Architecture
🔥 What if you could replace MySQL, Redis, MongoDB, ClickHouse, Elasticsearch, Oracle, Cassandra, PostgreSQL, and more with a single binary?
HarnessDB is a universal database simulation platform that speaks 14 different database protocols simultaneously. Built in Rust with Apache DataFusion, it's the world's first database that can replace:
- Relational Databases: MySQL, PostgreSQL, Oracle
- NoSQL Databases: Redis, MongoDB, Cassandra
- OLAP Databases: ClickHouse, Elasticsearch, AnalyticDB
- Cloud Databases: MaxCompute (ODPS), Hologres, TableStore, Lindorm
- Specialized: InfluxDB (Time Series), Vector Database (AI/ML)
All with a single ~50MB binary. No containers. No clusters. No cloud bills.
Like a chameleon adapts to its environment, HarnessDB adapts to any database protocol:
# Start HarnessDB
./harness-db
# Connect with ANY client
mysql -h 127.0.0.1 -P 9030 # MySQL client
psql -h 127.0.0.1 -P 15432 # PostgreSQL client
redis-cli -h 127.0.0.1 -p 6379 # Redis client
mongo --host 127.0.0.1 --port 27017 # MongoDB client
curl http://127.0.0.1:9200 # Elasticsearch API
clickhouse-client --port 9000 # ClickHouse client
# ... and 8 more protocols!- Local Development: Test against MySQL, Redis, MongoDB without installing them
- CI/CD: Spin up a full database stack in seconds for testing
- Learning: Experiment with 14 different database systems instantly
- Prototyping: Switch databases without changing your application code
- Cost Reduction: Replace 14 different database systems with one
- Simplified Ops: One binary to deploy, monitor, and maintain
- Multi-Cloud: Compatible with Alibaba Cloud, AWS, Azure, GCP services
- Migration Path: Test migrations between database systems easily
- MaxCompute Compatible: Test ODPS SQL locally without cloud costs
- Hologres Compatible: Develop real-time analytics locally
- TableStore Compatible: Simulate OTS for development
- Lindorm Compatible: Test HBase-like workloads locally
| Protocol | Port | Compatible With | Client |
|---|---|---|---|
| MySQL | 9030 | MySQL 5.7/8.0, RDS, Doris, StarRocks | mysql |
| PostgreSQL | 15432 | PostgreSQL 14, Hologres | psql |
| Oracle | 1521 | Oracle 11g+, PolarDB-O | SQL*Plus, JDBC |
| Protocol | Port | Compatible With | Client |
|---|---|---|---|
| Redis | 6379 | Redis 6+, Tair | redis-cli, all Redis drivers |
| MongoDB | 27017 | MongoDB 4.4+, ApsaraDB | mongo, all MongoDB drivers |
| Cassandra | 9042 | Cassandra 3.x+, ScyllaDB | cqlsh, all Cassandra drivers |
| Protocol | Port | Compatible With | Client |
|---|---|---|---|
| ClickHouse | 8123 | ClickHouse 20+ | clickhouse-client, HTTP |
| Elasticsearch | 9200 | Elasticsearch 7.x, OpenSearch | curl, all ES clients |
| AnalyticDB MySQL | 3307 | AnalyticDB MySQL | mysql |
| Protocol | Port | Compatible With | Client |
|---|---|---|---|
| MaxCompute | 9031 | MaxCompute (ODPS) | pyodps, REST API |
| Hologres | 15432 | Hologres | psql |
| TableStore | 8087 | TableStore (OTS) | REST API, SDK |
| Lindorm | 30030 | Lindorm, HBase | HBase shell |
| Protocol | Port | Compatible With | Client |
|---|---|---|---|
| InfluxDB | 8086 | InfluxDB 1.x, TSDB | influx, line protocol |
| Vector DB | 19530 | Milvus, Pinecone | REST API, gRPC |
git clone https://github.com/walker83/HarnessDB.git
cd HarnessDB
cargo build --release./target/release/harness-dbThat's it! All 14 protocols are now listening on their default ports.
mysql -h 127.0.0.1 -P 9030 -urootCREATE DATABASE demo;
USE demo;
CREATE TABLE users (id INT, name VARCHAR(50), age INT);
INSERT INTO users VALUES (1, 'Alice', 30);
SELECT * FROM users;redis-cli -h 127.0.0.1 -p 6379SET mykey "Hello HarnessDB"
GET mykey
HSET user:1 name "Bob" age 25
HGETALL user:1
mongo --host 127.0.0.1 --port 27017db.users.insert({name: "Charlie", age: 35})
db.users.find()curl -X POST "http://127.0.0.1:8123/?query=SELECT%20*%20FROM%20users"curl -X PUT "http://127.0.0.1:9200/my-index" \
-H 'Content-Type: application/json' \
-d '{"title": "Hello HarnessDB"}'from odps import ODPS
o = ODPS('harness', 'harness-secret', 'default',
endpoint='http://127.0.0.1:9031/api')
o.execute_sql("""
CREATE TABLE user_events (
user_id BIGINT,
action STRING,
amount DOUBLE
) PARTITIONED BY (ds STRING) LIFECYCLE 365
""").wait_for_success()All protocols can be independently enabled/disabled via config/server.toml:
[servers.mysql]
enabled = true
port = 9030
[servers.redis]
enabled = true
port = 6379
[servers.mongodb]
enabled = true
port = 27017
[servers.clickhouse]
enabled = true
port = 8123
[servers.elasticsearch]
enabled = true
port = 9200
# ... configure all 14 protocolsOr use command-line flags:
./harness-db \
--mysql-port 9030 \
--redis-port 6379 \
--mongodb-port 27017 \
--clickhouse-port 8123 \
--elasticsearch-port 9200┌─────────────────────────────────────────────────────────┐
│ Client Applications │
│ mysql | psql | redis-cli | mongo | curl | clickhouse │
└────────────────┬────────────────────────────────────────┘
│
┌────────────┼────────────────────────────────┐
│ │ │
▼ ▼ ▼
┌────────┐ ┌──────────┐ ┌──────────┐ ┌──────────────┐
│ MySQL │ │ Redis │ │ MongoDB │ │ ClickHouse │
│ :9030 │ │ :6379 │ │ :27017 │ │ :8123 │
└───┬────┘ └────┬─────┘ └────┬─────┘ └──────┬───────┘
│ │ │ │
└────────────┴──────────────┴────────────────┘
│
▼
┌────────────────┐
│ Protocol Layer │
│ (14 Protocols) │
└────────┬───────┘
│
▼
┌────────────────┐
│ Query Engine │
│ (DataFusion) │
└────────┬───────┘
│
▼
┌────────────────┐
│ Storage Engine │
│ (Parquet) │
└────────────────┘
- Binary Size: ~50MB
- Memory: ~100MB baseline
- Startup: <1 second
- Query Latency: 10-50ms (depends on protocol)
- Throughput: 1000+ QPS (single instance)
# Run all tests
cargo test --workspace
# Results: 180 passed, 5 failed (97% pass rate)Replace MySQL, Redis, MongoDB installations with one binary:
# Start HarnessDB
./harness-db
# Your app can now connect to:
# - MySQL on :9030
# - Redis on :6379
# - MongoDB on :27017
# All from one process!Spin up a full database stack in your CI pipeline:
# .github/workflows/test.yml
- name: Start HarnessDB
run: ./harness-db &
- name: Run Tests
run: cargo testTest MaxCompute/Hologres queries locally:
# Test your ODPS SQL without cloud costs
from odps import ODPS
o = ODPS('harness', 'harness-secret', 'default',
endpoint='http://localhost:9031/api')
o.execute_sql('SELECT * FROM my_table').wait_for_success()Test your application against multiple databases:
# Test against MySQL
mysql_client.connect('localhost:9030')
# Test against PostgreSQL
pg_client.connect('localhost:15432')
# Test against Redis
redis_client.connect('localhost:6379')
# All from the same binary!- DDL: CREATE/DROP DATABASE, CREATE/DROP TABLE, ALTER TABLE
- DML: INSERT, UPDATE, DELETE, SELECT
- Queries: JOIN, WHERE, GROUP BY, ORDER BY, HAVING, LIMIT
- Aggregates: COUNT, SUM, AVG, MIN, MAX, GROUP_CONCAT
- Functions: 100+ built-in functions (date, string, math, etc.)
- Window Functions: ROW_NUMBER, RANK, LAG, LEAD, etc.
Boolean, Int8-64, Float32/64, Decimal, Date, DateTime, Timestamp, String, Binary, Array, Map, Struct, JSON
We welcome contributions! Here's how you can help:
- ⭐ Star the repo - helps discovery
- 🐛 Report bugs - open an issue
- 💡 Suggest features - share your use case
- 🔧 Submit PRs - fix bugs or add features
- 📝 Improve docs - help others learn
See CONTRIBUTING.md for guidelines.
- Language: Rust (~80,000 lines)
- Crates: 28
- Protocols: 14
- Tests: 180 passed
- Supported Clients: 100+ (MySQL, PostgreSQL, Redis, MongoDB, etc.)
- License: Apache 2.0
- ✅ 14 protocol implementations
- ✅ Core SQL engine
- ✅ Configuration system
- ✅ 97% test pass rate
- Distributed transactions (2PC)
- Replication and high availability
- Advanced query optimization
- Materialized views
- Cluster mode (multi-node)
- Cloud-native deployment (Kubernetes)
- Advanced security (encryption, RBAC)
- Real-time streaming
Apache License 2.0. See LICENSE.
- Apache DataFusion - Query engine
- Apache Arrow - Columnar format
- Apache Parquet - Storage format
- Apache Doris - SQL dialect inspiration
- sqlparser-rs - SQL parsing
If you find HarnessDB useful, please consider:
- ⭐ Starring the repo - helps others discover it
- 🐦 Tweeting about it - spread the word
- 📝 Writing a blog post - share your experience
- 🎥 Creating a video - show how you use it