展示 HN: Minikv – 用 Rust 编写的分布式键值和对象存储(Raft, S3 API)
Show HN: Minikv – Distributed key-value and object store in Rust (Raft, S3 API)

原始链接: https://github.com/whispem/minikv

## minikv:基于Rust的分布式键值和对象存储 minikv是一个健壮的、多租户的键值和对象存储,使用Rust构建,专为学习和生产使用而设计。它通过Raft共识和2PC提供强一致性,并通过预写式日志(WAL)确保数据持久性。 最近的更新(v0.7.0)引入了基于值的搜索的二级索引、多键事务、流式导入/导出以及持久化的S3支持的对象存储。之前的版本添加了企业级安全功能,如加密、配额和审计日志。 主要特性包括用于可扩展性的虚拟分片、可插拔的存储选项(内存、RocksDB、Sled)以及通过Prometheus指标和内置管理仪表板提供的全面可观察性。它提供HTTP REST和S3兼容的API,以及用于内部通信的gRPC。 minikv非常适合探索分布式系统的工程师、试验Rust基础设施的团队以及对构建可靠、可扩展系统中的权衡感兴趣的任何人。它在GitHub上可用,并高度重视测试、文档和持续集成。

## Minikv:一个基于Rust的分布式存储引擎 Minikv是由开发者whispem发布的一个新的开源分布式键值和对象存储,使用Rust编写。它专为学习、实验和自托管而设计,结合了强一致性的键值数据库(使用Raft共识)和兼容S3的对象存储接口。 主要特性包括自动故障转移、分片、可插拔的存储后端(内存、RocksDB、Sled)、具有访问控制的多租户、通过Prometheus提供的指标、TLS安全以及使用Docker/Kubernetes轻松部署。可以通过`git clone`和`cargo run`进行快速演示。 该项目最初是开发者个人学习真实分布式系统的实践。目前专注于实验和收集反馈,长期目标是潜在地开发一个生产就绪的存储解决方案。最近在Hacker News上的讨论引发了对项目代码作者和复杂性的质疑,一些评论员认为它可能严重依赖于AI生成的代码。开发者表示所有核心代码都是手工编写的,AI辅助仅限于文档编写。 [https://github.com/whispem/minikv](https://github.com/whispem/minikv)
相关文章

原文

A distributed, multi-tenant key-value & object store written in Rust

minikv provides strong consistency (Raft + 2PC), durability (WAL), and production-grade observability, security, and multi-tenancy — all in a modern Rust codebase.

Built in public as a learning-by-doing project — now evolved into a complete, reference implementation of distributed systems in Rust.

Repo Rust License: MIT Production Grade Build Status


🚦 What's New in v0.7.0

minikv v0.7.0 brings advanced data management and query capabilities :

  • Secondary indexes : Search keys by value content with GET /search?value=<substring>
  • Multi-key transactions : Execute multiple operations atomically with POST /transaction
  • Streaming/batch import/export : Bulk data operations with POST /admin/import & GET /admin/export
  • Durable S3-backed object store : Persistent storage for S3-compatible API via pluggable backends

Previous highlights (v0.6.0) : enterprise security, multi-tenancy, encryption at rest, quotas, audit logging, persistent backends, watch/subscribe system.



minikv is a distributed key-value store written in Rust, designed for simplicity, speed, and reliability.

Who is this for ?
minikv is for engineers learning distributed systems, teams experimenting with Rust-based infrastructure, and anyone curious about consensus, durability, and system trade-offs.

  • Clustered : Raft consensus and 2PC for transactional writes
  • Virtual Sharding : 256 vshards for elastic scaling & balancing
  • WAL : Write-ahead log for durability
  • gRPC for node communication, HTTP REST & S3 API for clients
  • Bloom filters, snapshots, watch/subscribe for performance & reactivity

  • Rust – core logic
  • Shell – orchestration/automation
  • JavaScript – benchmarks, tools
  • Makefile – build flows

git clone https://github.com/whispem/minikv.git
cd minikv
cargo build --release

# Start a node
cargo run -- --config config.example.toml

# API examples
curl localhost:8080/health/ready   # readiness
curl localhost:8080/metrics        # Prometheus metrics
curl localhost:8080/admin/status   # admin dashboard

# Create API key (admin)
curl -X POST http://localhost:8080/admin/keys -d '{"role":"ReadWrite","tenant_id":"acme"}'

# S3 (demo)
curl -X PUT localhost:8080/s3/mybucket/mykey -d 'hello minikv!'
curl localhost:8080/s3/mybucket/mykey

For cluster setup and advanced options, see the documentation.


  • Raft: consensus and leader election
  • 2PC: atomic distributed/batch writes
  • Virtual Shards: scale and rebalance across 256 partitions
  • Pluggable Storage: in-memory, RocksDB, Sled
  • Admin API: HTTP endpoints for status, metrics and config
  • Config: via environment, file or CLI flags

  • Write throughput : over 50,000 operations/sec (single node, in-memory)
  • Sub-millisecond read latency
  • Cluster tested (3–5 nodes, commodity VMs)
  • Built-in Prometheus metrics

  • Raft consensus (multi-node, strong consistency)
  • Two-phase commit (2PC) for atomic multi-key transactions
  • 256 virtual shards for cluster scaling and rebalancing
  • Write-ahead log (WAL) for durability
  • Auto-rebalancing, graceful leader failover, hot-join and node removal
  • Time-To-Live keys (TTL)
  • LZ4 compression (configurable)
  • Bloom filters and index snapshots
  • Pluggable and persistent storage: in-memory, RocksDB, Sled
  • Batch & range operations, prefix queries
  • HTTP REST (CRUD, batch, range, admin)
  • S3-compatible API (with TTL extensions)
  • gRPC (internal)
  • WebSocket and SSE endpoints for real-time watch/subscribe events
  • API keys (Argon2) and JWT authentication
  • Role-based access control (RBAC) and audit logging
  • Multi-tenant isolation
  • AES-256-GCM encryption at rest
  • Per-tenant quotas (storage, requests, rate limits)
  • TLS (HTTP & gRPC)
  • Admin dashboard
  • Prometheus metrics (counters, histograms)
  • Request and endpoint statistics
  • Structured logging and tracing spans
  • Kubernetes health probes
  • Memory-safe Rust
  • Test suite, automated CI
  • Documentation and sample config
  • Single static binary


minikv started as a 24-hour challenge by a Rust learner (82 days into the language!). It now serves as both a playground and a reference for distributed systems, demonstrating curiosity, learning-by-doing, and robust engineering.



cargo test           # Run all tests
cargo clippy --fix   # Lint and fix
cargo fmt            # Format code

Continuous Integration runs on push & PR via .github/workflows/ci.yml.


Issues and PRs welcome! See CONTRIBUTING.md.



联系我们 contact @ memedata.com