Skip to content

solisoft/kv

Repository files navigation

SoliKV

A high-performance in-memory key-value database written in Rust, compatible with the Redis protocol.

Features

  • Redis RESP Protocol Compatible - Drop-in replacement for Redis clients
  • REST API - HTTP-based access on port 5020
  • Sharding - Horizontal scaling across multiple shards
  • Persistence - RDB snapshots and AOF (Append-Only File) with configurable fsync policies
  • Redis RDB Import - Import existing Redis dump.rdb files for seamless migration
  • Pub/Sub - Built-in publish/subscribe messaging
  • Data Types - Strings, Lists, Sets, Sorted Sets, Hashes with TTL support

Getting Started

Quick Install

# Install to ~/.local/bin
curl -sSL https://raw.githubusercontent.com/solisoft/kv/main/install.sh | sh

# Or install system-wide (requires sudo)
curl -sSL https://raw.githubusercontent.com/solisoft/kv/main/install.sh | sh -s -- --system

Build

cargo build --release

Run

cargo run --release -- \
  --port 6379 \
  --rest-port 5020 \
  --shards 4 \
  --dir ./data

Docker

# Pull and run
docker run -p 6379:6379 -p 5020:5020 -v ./data:/data ghcr.io/solisoft/kv:latest --dir /data

# Or with custom config
docker run -p 6379:6379 -p 5020:5020 -v ./data:/data \
  ghcr.io/solisoft/kv:latest --dir /data --shards 4 --appendfsync always

# Or build locally
docker build -t solikv .
docker run -p 6379:6379 -p 5020:5020 -v ./data:/data solikv --dir /data

Usage

Redis CLI

redis-cli -p 6379
SET mykey "Hello"
GET mykey

REST API

curl -X GET http://localhost:5020/key/mykey
curl -X POST -H "Content-Type: application/json" -d '{"value": "Hello"}' http://localhost:5020/key/mykey

Configuration

Flag Default Description
--port 6379 Redis RESP protocol port
--rest-port 5020 REST API port
--shards 0 Number of shards (0 = auto-detect CPU cores)
--bind 0.0.0.0 Bind address
--log-level info Log level
--dir data Data directory for persistence
--dbfilename dump RDB snapshot filename
--appendonly true Enable AOF persistence
--appendfsync everysec AOF fsync policy: always, everysec, no
--import-redis-rdb - Path to a Redis dump.rdb file to import at startup

Migrating from Redis

SoliKV can import standard Redis RDB snapshot files. Generate a dump from your Redis instance and load it at startup:

# On your Redis server
redis-cli BGSAVE
cp /var/lib/redis/dump.rdb /tmp/dump.rdb

# Import into SoliKV
./solikv --import-redis-rdb /tmp/dump.rdb --port 6379

Supported Redis data types: String, List, Set, Sorted Set, Hash — including all compact encodings (ziplist, listpack, intset, quicklist, LZF compression). Already-expired keys are automatically filtered out. Multi-database RDB files are flattened into a single namespace.

Unsupported types (Streams, Modules) are skipped with a warning.

Architecture

SoliKV is built as a Rust workspace with several crates:

  • solikv-core - Core data types and operations
  • solikv-engine - Command execution engine with sharding
  • solikv-server - RESP and REST server implementations
  • solikv-persist - RDB and AOF persistence
  • solikv-pubsub - Publish/subscribe broker
  • solikv-resp - Redis protocol parser
  • solikv-cluster - Clustering support
  • solikv-replication - Master/replica replication

Performance

SoliKV is designed for high performance with:

  • Lock-free sharding with crossbeam-skiplist
  • MiMalloc memory allocator
  • Async I/O with Tokio
  • Configurable fsync policies for durability vs performance tradeoffs

License

MIT License - see LICENSE file.

About

Rust KV store compatible with Redis

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors