Trying to build a Redis clone for learning the internals of how Redis works and how to build a low-latency system. The reference article can be found here
- Install the
redis-cli
on your machine.
# Ubuntu example
sudo apt-get install redis
# Arch Linux example
sudo pacman -S redis
- Compile and run the program. You should receive a listening message of PORT 6379 which is also the default port of Redis. Make sure nothing else is running on that port.
go build
./bluedis
- Run the redis-cli and type out redis commands through another terminal. The following redis commands work
- get
- set
- hget
- hset
- hgetall
- Example 1 (For testing SET, GET)
set name ritesh # sets the name to ritesh
get name # returns ritesh
- Example 2 (For testing HGET, HSET, HGETALL)
hset users u1 ritesh # sets u1 as ritesh
hget users u1 # returns ritesh
hset users u2 abhi # set u2 as abhi
hgetall users # should return both users
- Example 3 (For testing AOF)
Restart theBluedis
server after executing someSET
commands. Then try toGET
them. It ought to get back your data thereby proving persistance.
- Build the server
- Reading RESP
- Writing RESP
- Redis Commands
- Data Persistance with Append-Only File