This project is a Redis-compatible server implemented in Go.
Supports a wide array of commands and features, grouped by functionality:
- RDB Persistence
- Transactions
- Streams (XADD, XRANGE, XREAD)
- Lists (LPUSH, RPUSH, LRANGE, etc.)
- Replication
- Go (version 1.18 or newer recommended).
redis-cli(for interacting with the server).
- Clone the repository.
- Make the build script executable:
chmod +x build.sh
- Run the build script:
This will create an executable at
./build.sh
./bin/go-redis.
You can run the server as a master or a replica.
To run as a master:
./bin/go-redis --port 6379To run as a replica of a master running on port 6379:
./bin/go-redis --port 6380 --replicaof localhost 6379You can use redis-cli to connect to your running server instance.
# Connect to a server on the default port
redis-cli
# Connect to a server on a specific port
redis-cli -p 6380
# Send some commands
127.0.0.1:6379> PING
PONG
127.0.0.1:6379> SET name "your-name"
OK
127.0.0.1:6379> GET name
"your-name"
127.0.0.1:6379> XADD mystream * sensor-id 1234 temperature 19.8
"1726434915357-0"