Ruvector Cluster
Distributed clustering and sharding for Ruvector vector databases.
ruvector-cluster provides horizontal scaling capabilities with consistent hashing, shard management, and cluster coordination. Enables Ruvector to scale to billions of vectors across multiple nodes. Part of the Ruvector ecosystem.
Why Ruvector Cluster?
- Horizontal Scaling: Distribute data across multiple nodes
- Consistent Hashing: Minimal rebalancing on cluster changes
- Auto-Sharding: Automatic shard distribution and balancing
- Fault Tolerant: Handle node failures gracefully
- Async-First: Built on Tokio for high-performance networking
Features
Core Capabilities
- Cluster Membership: Node discovery and health monitoring
- Consistent Hashing: Ketama/Jump hash for shard placement
- Shard Management: Create, migrate, and balance shards
- Node Coordination: Leader election and consensus
- Failure Detection: Heartbeat-based failure detection
Advanced Features
- Dynamic Rebalancing: Auto-balance on node join/leave
- Rack Awareness: Place replicas across failure domains
- Hot Spot Detection: Identify and redistribute hot shards
- Gradual Migration: Zero-downtime shard migration
- Cluster Metrics: Prometheus-compatible metrics
Installation
Add ruvector-cluster to your Cargo.toml:
[]
= "0.1.1"
Quick Start
Initialize Cluster
use ;
async
Shard Operations
use ;
// Get shard for a vector ID
let shard_id = cluster.get_shard_for_key?;
// Get nodes hosting a shard
let nodes = cluster.get_shard_nodes.await?;
println!;
// Manual shard migration
cluster.migrate_shard.await?;
// Trigger rebalance
cluster.rebalance.await?;
Cluster Health
// Check cluster health
let health = cluster.health.await?;
println!;
println!;
// Get node status
for node in cluster.nodes.await?
API Overview
Core Types
// Cluster configuration
// Node information
// Shard information
Cluster Operations
Architecture
┌─────────────────────────────────────────────────────────────┐
│ Cluster │
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
│ │ Node 1 │ │ Node 2 │ │ Node 3 │ │ Node 4 │ │
│ │ Shards: │ │ Shards: │ │ Shards: │ │ Shards: │ │
│ │ 0,4,8 │ │ 1,5,9 │ │ 2,6,10 │ │ 3,7,11 │ │
│ └────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘ │
│ │ │ │ │ │
│ └────────────┴────────────┴────────────┘ │
│ Gossip Protocol │
└─────────────────────────────────────────────────────────────┘
Related Crates
- ruvector-core - Core vector database engine
- ruvector-raft - RAFT consensus
- ruvector-replication - Data replication
Documentation
- Main README - Complete project overview
- API Documentation - Full API reference
- GitHub Repository - Source code
License
MIT License - see LICENSE for details.