Server Mode
Redlite includes a standalone server that implements the Redis protocol over TCP. Standard Redis clients can connect to it.
Starting the Server
Section titled “Starting the Server”Basic Usage
Section titled “Basic Usage”# Default: persistent storage, port 6379./redlite --db mydata.db
# In-memory mode (no persistence)./redlite --storage memory
# Alternative: SQLite's :memory: syntax also works./redlite --db :memory:Custom Port
Section titled “Custom Port”# Custom port./redlite --db mydata.db --addr 127.0.0.1:6380
# Bind to all interfaces./redlite --db mydata.db --addr 0.0.0.0:6379Command Line Options
Section titled “Command Line Options”| Option | Short | Default | Description |
|---|---|---|---|
--db | -d | redlite.db | Database file path |
--addr | -a | 127.0.0.1:6379 | Listen address and port |
--password | (none) | Require password for connections (like Redis requirepass) | |
--storage | file | Storage type: file or memory | |
--cache | 64 | SQLite page cache size in MB (larger = faster reads) | |
--max-disk | 0 | Maximum disk size in bytes (0 = unlimited). Evicts oldest keys when exceeded |
Connecting with redis-cli
Section titled “Connecting with redis-cli”$ redis-cli
127.0.0.1:6379> PINGPONG
127.0.0.1:6379> SET name "Redlite"OK
127.0.0.1:6379> GET name"Redlite"
127.0.0.1:6379> SET temp "expires" PX 5000OK
127.0.0.1:6379> GET temp"expires"
# Wait 5 seconds...
127.0.0.1:6379> GET temp(nil)With Authentication
Section titled “With Authentication”# Start server with password./redlite --db mydata.db --password secret
# Connect with password$ redis-cli -a secret127.0.0.1:6379> PINGPONGUsing Redis Client Libraries
Section titled “Using Redis Client Libraries”Python
Section titled “Python”import redis
r = redis.Redis(host='localhost', port=6379)
# String operationsr.set('foo', 'bar')print(r.get('foo')) # b'bar'
# With expirationr.setex('session', 60, 'user_data') # expires in 60 secondsNode.js
Section titled “Node.js”import { createClient } from 'redis';
const client = createClient({ url: 'redis://localhost:6379' });await client.connect();
// String operationsawait client.set('foo', 'bar');console.log(await client.get('foo')); // 'bar'
// With expirationawait client.setEx('session', 60, 'user_data');package main
import ( "context" "github.com/redis/go-redis/v9")
func main() { rdb := redis.NewClient(&redis.Options{ Addr: "localhost:6379", })
ctx := context.Background()
rdb.Set(ctx, "foo", "bar", 0) val, _ := rdb.Get(ctx, "foo").Result() // val == "bar"}use redis::Commands;
fn main() -> redis::RedisResult<()> { let client = redis::Client::open("redis://127.0.0.1:6379/")?; let mut con = client.get_connection()?;
con.set("foo", "bar")?; let value: String = con.get("foo")?; // value == "bar"
Ok(())}Running as a Service
Section titled “Running as a Service”systemd (Linux)
Section titled “systemd (Linux)”Create /etc/systemd/system/redlite.service:
[Unit]Description=Redlite KV StoreAfter=network.target
[Service]Type=simpleExecStart=/usr/local/bin/redlite --db=/var/lib/redlite/data.dbRestart=alwaysUser=redliteGroup=redlite
[Install]WantedBy=multi-user.targetsudo systemctl enable redlitesudo systemctl start redliteDocker
Section titled “Docker”FROM rust:1.75 as builderWORKDIR /appCOPY . .RUN cargo build --release
FROM debian:bookworm-slimCOPY --from=builder /app/target/release/redlite /usr/local/bin/EXPOSE 6379CMD ["redlite", "--db=/data/redlite.db", "--addr=0.0.0.0:6379"]docker build -t redlite .docker run -p 6379:6379 -v redlite-data:/data redliteCustom Commands
Section titled “Custom Commands”Redlite adds these commands on top of Redis:
- HISTORY - Track and query historical data with time-travel queries. See History Tracking for full documentation.
- KEYINFO - Get detailed key metadata (type, TTL, created/updated timestamps)
- VACUUM - Delete expired keys and reclaim disk space
Differences from Redis
Section titled “Differences from Redis”When using server mode, be aware of these differences:
- Persistence - Persisted to disk by default (or in-memory with
--storage memory) - Memory - Not bounded by RAM; uses disk storage
- Commands - Only subset of Redis commands supported (see Commands)
- Clustering - No cluster mode; single-node only
- Pub/Sub - Supported (server mode only)