# KiviDB

> A multi-threaded Redis and Valkey alternative in Rust, with full-text and vector search built in

- Category: Retrieval & Knowledge (RAG) / Vector Databases
- Language: Rust
- Licence: AGPL-3.0
- Repository: https://github.com/kividbio/kividb
- Website: https://kividb.io
- Canonical page: https://ai-tldr.dev/tools/kividb/
- Updated: 2026-10-31

## In short

KiviDB is an in-memory key-value server written in Rust that speaks the Redis protocol (RESP2 and RESP3). It sits in the Vector Databases category of the Retrieval & Knowledge (RAG) tools and is open-source, written in Rust and licensed AGPL-3.0. To get started: run the server with Docker.

## Overview

KiviDB is an in-memory key-value server written in Rust that speaks the Redis protocol (RESP2 and RESP3). Existing Redis clients, libraries and redis-cli work against it unchanged; the one visible difference is that it listens on port 6380 rather than 6379, so the two can run side by side. It persists to native snapshots and an optional append-only file, and supports replication, a cluster mode with failover, ACLs and, in optional builds, Lua scripting and TLS.

Where Redis and Valkey run commands on one thread, KiviDB shards its keyspace across every core. The project's own October 2026 benchmark on 32 cores of an AWS Graviton3 bare-metal server reports about 21 million pipelined GETs per second for KiviDB 1.1.0, against 9.1 million for Dragonfly 2.0.2 and 2.4 million for Redis 8.10; without pipelining, the same run puts Dragonfly slightly ahead. The README asks readers to treat the figures as one controlled capture and to measure on their own hardware.

For AI applications the relevant part is search. KiviDB implements Redis Stack-style FT.* commands, so one index over hash keys can hold a VECTOR field (FLAT or HNSW) next to TEXT, TAG and NUMERIC fields, and a single FT.SEARCH can run a KNN query alongside BM25 full-text and filters. Snapshots store the index schemas and, after SAVE or BGSAVE, each vector field's HNSW graph, so a restart reloads the graph instead of rebuilding it. The project launched in October 2026 and is licensed AGPL-3.0-only; the README notes that using KiviDB does not place your application under the AGPL.

## What it does

- Redis-compatible command surface over RESP2 and RESP3, so existing clients, redis-cli and libraries connect unchanged (supported commands are listed in COMMANDS.md)
- Multi-threaded, sharded design that runs commands on every core, with io_uring on Linux when the kernel allows it and a Tokio fallback
- Redis Stack-style FT.* search: full-text (BM25), tag and numeric fields, and vector ANN with FLAT or HNSW indexes, including hybrid search
- Snapshot (dump.kdb) and append-only-file persistence; snapshots also keep index schemas and HNSW graphs across restarts
- Replication, cluster mode with gossip, failure detection and failover, ACLs, and protected mode on by default
- Ships as release binaries for Linux and macOS, .deb and .rpm packages, multi-arch Docker images, and a Kubernetes operator; Lua and TLS are optional build variants

## Getting started

These steps follow the KiviDB README: start the server, confirm a Redis client can reach it, then build a vector index with the FT.* commands.

1. Run the server with Docker

   The image listens on 6380 and its default command turns protected mode off, because a container is never reached over loopback. If you pass your own flags, that default is replaced — set a password.

```bash
docker run -d -p 6380:6380 kividb/kividb

# with your own flags, set a password
docker run -p 6380:6380 ghcr.io/kividbio/kividb --requirepass "change-me"
```

2. Connect with any Redis client

   redis-cli works as-is; just point it at port 6380. Linux users can instead install the .deb or .rpm from the release page, which adds a systemd unit and a config at /etc/kividb/kividb.conf.

```bash
redis-cli -p 6380 PING        # PONG
```

3. Create a vector index

   Declare an index over hash keys with a prefix and at least one VECTOR field; TEXT, TAG and NUMERIC fields are optional. This one is a 128-dimension HNSW index using cosine distance.

```bash
redis-cli -p 6380 FT.CREATE idx ON HASH PREFIX 1 doc: SCHEMA \
  vec VECTOR HNSW 10 TYPE FLOAT32 DIM 128 DISTANCE_METRIC COSINE M 16 EF_CONSTRUCTION 128
```

4. Store vectors and query with KNN

   Write each vector into the hash field as raw little-endian FLOAT32 bytes (DIM × 4 bytes), the same convention as Redis Stack and redis-py with numpy, using your client's binary-safe HSET. Then query with Dialect 2, passing the query vector as a named binary parameter.

```bash
redis-cli -p 6380 FT.SEARCH idx '*=>[KNN 10 @vec $q]' PARAMS 2 q <blob> DIALECT 2
```

5. Save the graph after a large ingest

   Run SAVE (or schedule BGSAVE) so the next start reloads the HNSW graph from disk instead of rebuilding it from the hashes; while indexes rebuild, most commands answer LOADING.

```bash
redis-cli -p 6380 SAVE
```

## When to use it

- Keep embeddings for a RAG pipeline in the same store as the cache and session data you already keep in Redis, with metadata filters in the same FT.SEARCH
- Replace a single-threaded Redis or Valkey instance with a drop-in, multi-core server without changing client code
- Run Redis Stack-style full-text and vector search under an open-source AGPL licence on your own hardware

## Version history

- 2026-10-31 v1.1.3: Security release fixing three advisories: a TLS handshake denial of service, and two cases where acknowledged writes could be lost. It also repairs HNSW graphs after an AOF replay and keeps search indexes in sync on key expiry and RENAME.
