This project is a simple Redis-like server implemented in Go. It supports basic Redis commands like PING
, SET
, GET
, HSET
, and HGET
. The server also supports Append-Only File (AOF) persistence to ensure data durability.
- PING: Check the server's status.
- SET: Set a string key to a string value.
- GET: Get the value of a string key.
- HSET: Set a field in a hash.
- HGET: Get the value of a field in a hash.
- AOF Persistence: Commands that modify data (
SET
andHSET
) are logged to an AOF file to ensure data durability.
- Docker
- Docker Compose
-
Build and run the server using Docker Compose:
docker-compose up --build
-
Interact with the server using a Redis client:
You can use any Redis client to connect to the server running on
localhost:6379
. For example, usingredis-cli
:redis-cli -p 6379
or utilize the existing docker compose setup like:
docker compose exec redis-client sh redis-cli -h redis-server -p 6379
after which you can start sending commands to the server.
Example commands:
SET key1 value1 GET key1 HSET hash1 field1 value1 HGET hash1 field1
The AOF file is stored in a Docker volume to persist data across container restarts. The file is mapped to the ./app
directory in the container.
Inspired by build-your-own-x repo