Project Name: RedisServer
Description: RedisServer is a lightweight, in-memory key-value data store inspired by the Redis database. This project provides basic Redis functionalities such as setting and getting values, handling key expiration, and simple replication between master and slave servers.
Features:
- Basic Redis commands:
PING,ECHO,SET,GET,DEL,INFO,EXISTS,SHUTDOWN - Key expiration with TTL
- Simple master-slave replication
- Customizable logging with colored output
- Simple Client CLI
- Unit tests for core functionalities
- Python 3.6 or higher
unittestlibrary (comes with standard Python library)socketlibrary (comes with standard Python library)argparselibrary (comes with standard Python library)logginglibrary (comes with standard Python library)threadinglibrary (comes with standard Python library)
Clone the repository:
git clone https://github.com/DeadMuffin/redis-server.git
cd RedisServer-
Start the Redis server:
python src/server.py --port 8000 --replicaof "localhost 6379"Arguments:
--port: (Optional, Default: 6379) Port number to use--replicaof: (Optional) Master host and port number to use for slave
Note: The server will be in Slave mode when
--replicaofis passed. -
Use the provided client to send commands:
python src/client.py --port 6379 PING
-
Sending a PING command:
python src/client.py --port 6379 PING
-
Setting a key-value pair:
python src/client.py --port 6379 SET mykey "Hello, World!" -
Getting the value of a key:
python src/client.py --port 6379 GET mykey
-
Deleting a key:
python src/client.py --port 6379 DEL mykey
-
Checking if a key exists:
python src/client.py --port 6379 EXISTS mykey
These examples illustrate how to interact with the Redis server using the client.py script by specifying the appropriate commands and arguments.
License Type: not decided yet