Rust-EDIS implements a scalable, distributed key-value store based on the Reader/Writer Shard Model, inspired by Redis. The system enables efficient data storage, fault tolerance, and high scalability, making it ideal for applications requiring dynamic scaling and consistent performance.
rustedis.mov
- Write Shards: Isolated shards handle key-value pairs using deterministic hashing to maintain consistency.
- Read Shards: Synchronize with write shards to replicate data, enabling eventual consistency. Clients access read replicas through a round-robin strategy.
- Dynamic Shard Management: Add read replicas dynamically for increased fault tolerance and scalability.
-
Main Info Instance:
- Tracks the IP/ports of all shards (read/write).
- Assists with shard discovery and management.
-
Write Shards:
- Store key-value pairs.
- Deterministic hashing ensures a specific shard handles a given key.
-
Read Shards:
- Maintain replicas of data from write shards.
- Round-robin distribution ensures load balancing for read operations.
-
Client Binary:
- Provides commands for reading and writing data.
- Handles shard computation and request routing.
src/client.rs
: Implements the client for interacting with the system.src/info.rs
: Manages shard discovery and dynamic configuration.src/write_shard.rs
: Handles write requests and key-value storage.src/read_shard.rs
: Synchronizes with write shards and processes read requests.
- Rust Toolchain: Ensure you have Rust installed. You can download it from Rust's official site.
git clone https://github.com/your-repo-name.git
cd rust-edis
cargo build
-
Start the
info
instance:cargo run --bin info -- --write-shards=1
-
Start a write shard:
cargo run --bin write_shard
-
Start a read shard:
cargo run --bin read_shard
-
Run the client:
cargo run --bin client
- Write Data: Use the client binary to send write requests.
- Read Data: The client binary sends read requests, selects a read shard, and retrieves the data.
For the full dependency list, refer to the [dependencies]
section in Cargo.toml
.
To run the tests:
cargo test