This project is a learning endeavor to create a clone of a Redis server. It aims to replicate the basic functionalities of Redis, focusing on key-value storage, replication, and basic command processing. This project is purely educational and leverages only the Rust standard library, making it an excellent resource for understanding the internals of a Redis server and the Rust programming language.
Note: This project is intended for learning purposes and should not be used in production environments.
- Basic key-value storage
- Replication support to mimic master-replica dynamics
- Command processing for a subset of Redis commands
- Custom TCP server implementation
- Command-line interface for server configuration
- Rust (latest stable version recommended)
- Clone the repository:
git clone https://github.com/florian-trehaut/redis-server-clone.git- Navigate to the project directory:
cd redis-server- Build the project:
cargo build --releaseTo start the server with default configurations:
cargo run --releaseTo configure the server as a master or replica, use the command-line arguments:
cargo run --release -- [--port <port_of_master>]Or:
cargo run --release -- --replicaof <hostname> <port_of_master> [--port <port_of_replica>]The server can be configured either as a master or a replica through command-line arguments. The configuration is managed in the src/server_config/server.rs file, which parses the arguments and sets up the server accordingly.