高性能、开源的RAFT集群数据库:RooDB
High performance, open source RAFT clustered database: RooDB

原始链接: https://github.com/jgarzik/roodb

RooDB是一个分布式SQL数据库,旨在提供高可用性、高性能和易用性。它力求在开箱即用状态下,为大多数工作负载提供快速性能,支持单节点和多节点(领导者/副本)配置,并通过OpenRaft使用Raft共识算法进行复制。 RooDB采用LSM存储引擎和完整的SQL堆栈(解析器、计划器、执行器),提供MySQL兼容性,允许通过标准MySQL客户端连接(需要TLS)。它在Linux上使用`io_uring`,在其他平台上使用异步POSIX进行跨平台I/O。 该系统具有自调整功能,并且配置接近于零。数据和模式会被复制,Raft日志用作预写日志。RooDB通过各种配置(单/多节点、不同的I/O后端)使用MySQL CLI进行全面测试,确保了稳定可靠的SQL体验。关键依赖项包括`openraft`、`sqlparser`和可选的`io-uring`。

黑客新闻 新 | 过去 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 高性能、开源RAFT集群数据库:RooDB (github.com/jgarzik) 9点 由 jgarzik 16小时前 | 隐藏 | 过去 | 收藏 | 讨论 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请YC | 联系 搜索:
相关文章

原文

A highly available, high performance, easy to use distributed SQL database.

  • A general SQL database that is fast out-of-the-box for everyone
  • General purpose, Highly available, Self-tuning
  • Single node or multi-node (leader+replicas) configurations
  • Near-zero config

roodb should be high performance for all but the most massive, sharded-cluster workloads.

  • Raft Consensus: Distributed replication via OpenRaft for high availability
  • LSM Storage Engine
  • SQL Support: Parser (sqlparser-rs), query planner with optimizer, Volcano-style executor
  • Cross-Platform I/O: io_uring on Linux, async POSIX fallback on other platforms
  • MySQL-Compatible Protocol: Connect using standard mysql CLI or any MySQL client library (TLS required)
# Generate TLS certificate
mkdir -p certs
openssl req -x509 -newkey rsa:4096 -keyout certs/server.key -out certs/server.crt \
    -days 365 -nodes -subj "/CN=localhost"

# Initialize database (first time only, idempotent)
ROODB_ROOT_PASSWORD=secret ./target/release/roodb_init --data-dir ./data

# Start server
./target/release/roodb --port 3307 --data-dir ./data --cert-path ./certs/server.crt --key-path ./certs/server.key
mysql -h 127.0.0.1 -P 3307 -u root -p --ssl-mode=REQUIRED
# Run all tests (single-threaded - see Known Limitations)
cargo test --release

# Run a specific test
cargo test --release test_name

# Lint
cargo clippy --all-targets
src/
├── catalog/       # Schema catalog (tables, columns, system tables)
├── executor/      # Volcano-style query executor
├── io/            # Cross-platform async I/O (io_uring / POSIX)
├── planner/       # Query planner and optimizer
├── protocol/      # MySQL wire protocol implementation
├── raft/          # Raft consensus layer (OpenRaft)
├── server/        # TCP listener, connection handling
├── sql/           # SQL parsing and AST
├── storage/       # LSM storage engine
├── tls.rs         # TLS configuration
└── txn/           # Transaction management (MVCC)

Replication Model:

  • Leader accepts all writes, replicates via Raft
  • Replicas serve read-only queries from local storage
  • Schema stored in system tables, replicated like data
  • Raft log serves as the write-ahead log

RooDB includes a comprehensive integration test suite that validates the full SQL stack across 4 configurations:

Configuration Cluster I/O Backend
single_uring 1-node io_uring (Linux only)
single_posix 1-node POSIX
cluster_uring 3-node Raft io_uring (Linux only)
cluster_posix 3-node Raft POSIX

Tests use the mysql CLI to execute SQL against RooDB's client protocol.

Key dependencies:

  • openraft - Raft consensus
  • sqlparser - SQL parsing
  • io-uring - Linux io_uring (Linux only)

MIT

联系我们 contact @ memedata.com