Redis-bot
About This Project
This project is a lightweight Redis-like server built entirely in Python, designed for educational purposes and hands-on learning of system design principles. It supports essential Redis functionalities including command parsing, data persistence, replication simulation, and concurrent client handling. The server mimics Redis’s behavior closely using the RESP protocol and is designed to be modular and easy to extend.
Key Features Implemented
Server Setup
- Configurable port binding
- Multi-client support using Python threads
- RESP protocol parsing for command communication
Core Redis Commands
- PING, ECHO: Basic connectivity and message testing
- SET, GET, DEL, EXISTS: Key-value storage and retrieval
- Expiry and TTL handling via EX, EXPIRE, TTL, PERSIST
- INCR: Atomic key value increment
Persistence (RDB-like)
- SAVE command to serialize data into
dump.rdb - Auto-loading of data from
dump.rdbon server restart
Replication Simulation
- Handles REPLCONF and simulated PSYNC commands
- Supports FULLRESYNC responses
- Receives and stores RDB snapshot in
replica_dump.rdb - Parses and prints real-time commands from master
Testing Suite
Scripts to verify functionality:
test_save_command.py: Save a key and persist ittest_get_after_restart.py: Check key persistence after a restartreplica_test.py: Simulate a replica node receiving data
Run tests in order:
Save a key python test_save_command.py
Restart server, check key python test_get_after_restart.py
Simulate replica behavior python replica_test.py
Getting Started
To run the server: python core/server.py
Log in or sign up for Devpost to join the conversation.