Introduction
Redka is an embedded and standalone database that reimplements core Redis data structures on top of SQLite. It was created for use cases where you want the familiar Redis API for strings, hashes, lists, sets, and sorted sets, but need the data to be durable, portable, and queryable as a single file — without running a separate Redis server.
What Redka Does
- Implements Redis-compatible commands for strings, hashes, sets, sorted sets, and lists
- Stores all data in a single SQLite file with full ACID durability
- Provides both a standalone server mode and an embeddable Go library
- Supports key expiration and TTL management like Redis
- Allows direct SQL queries on the underlying SQLite tables for advanced use cases
Architecture Overview
Redka maps each Redis data type to a set of SQLite tables with appropriate indexes. The standalone server speaks the Redis RESP protocol, so any Redis client library can connect without modification. Internally, each command translates to one or more SQL operations within a transaction. The Go library provides the same API for embedding directly into Go applications without the network layer.
Self-Hosting & Configuration
- Install the binary via go install or download pre-built releases from GitHub
- Run redka with a database file path to start the RESP-compatible server
- Configure the listen address and port with command-line flags
- Embed as a Go library by importing the redka package and opening a database handle
- Back up the database by copying the single SQLite file while idle or using SQLite backup API
Key Features
- Redis RESP protocol compatibility means existing clients work without changes
- Single-file storage makes backup, replication, and migration trivial
- ACID transactions ensure data is never lost on crash or power failure
- No external dependencies or server processes when used as an embedded library
- Direct SQL access to the underlying data for reporting and analytics
Comparison with Similar Tools
- Redis — Redis runs as a separate server with in-memory storage; Redka is file-based with SQLite durability
- KeyDB — KeyDB is a multithreaded Redis fork; Redka trades speed for zero-ops SQLite portability
- DragonflyDB — Dragonfly is a high-performance Redis replacement; Redka targets embedded and single-node use
- BoltDB/bbolt — bbolt is a key-value store; Redka adds Redis data structures (hashes, sets, sorted sets)
- Valkey — Valkey is the Redis fork; Redka is a clean-room SQLite implementation of the Redis API
FAQ
Q: Is Redka as fast as Redis? A: No. Redka trades raw speed for durability and simplicity. It is suitable for moderate workloads where persistence matters more than microsecond latency.
Q: Does Redka support all Redis commands? A: Redka supports the core data structure commands (strings, hashes, lists, sets, sorted sets, keys). Advanced features like Lua scripting, pub/sub, and clustering are not supported.
Q: Can I use Redka with my existing Redis client library? A: Yes. The standalone server speaks the RESP protocol, so any standard Redis client in any language can connect.
Q: Is the SQLite database portable across operating systems? A: Yes. SQLite databases are cross-platform binary files that work on any OS without conversion.