Quick start¶
Prerequisites¶
- Rust stable toolchain (edition 2024)
- cmake (required by aws-lc-rs for TLS support)
Build from source¶
Clone the repository¶
Build the release binary¶
The default build uses the Monoio runtime with jemalloc:
Alternative build configurations
# Tokio runtime (required for macOS CI, CodeQL, GitHub Actions)
cargo build --release --no-default-features --features runtime-tokio
# Tokio with jemalloc
cargo build --release --no-default-features --features runtime-tokio,jemalloc
# Native CPU optimizations (recommended for benchmarking)
RUSTFLAGS="-C target-cpu=native" cargo build --release
Start the server¶
# Default: 127.0.0.1:6379, auto-detect CPU count for shards
./target/release/moon
# With specific options
./target/release/moon --port 6379 --shards 4
Connect¶
Any Redis client works out of the box:
redis-cli -p 6379
127.0.0.1:6379> PING
PONG
127.0.0.1:6379> SET hello world
OK
127.0.0.1:6379> GET hello
"world"
Docker¶
# Build the image
docker build -t moon .
# Run with default settings
docker run -p 6379:6379 moon
# Run with persistence
docker run -p 6379:6379 -v moon-data:/data moon \
moon --bind 0.0.0.0 --dir /data --appendonly yes
# Run with password and TLS
docker run -p 6379:6379 -p 6380:6380 moon \
moon --bind 0.0.0.0 --requirepass secret \
--tls-port 6380 --tls-cert-file /certs/server.crt --tls-key-file /certs/server.key
Client libraries¶
Moon is compatible with any Redis client. Here are a few examples:
Python SDK¶
from moondb import MoonClient, encode_vector
client = MoonClient(host="localhost", port=6379)
# Standard Redis commands
client.set("hello", "world")
# Vector search
client.vector.create_index("docs", dim=384, metric="COSINE")
client.hset("doc:1", mapping={"vec": encode_vector([0.1] * 384), "title": "Hello"})
results = client.vector.search("docs", [0.1] * 384, k=5)
# Graph engine
client.graph.create("social")
client.graph.add_node("social", "Person", name="Alice")
See sdk/python/README.md for async client, LangChain/LlamaIndex integrations, and full API reference.
Try Moon-native features¶
redis-cli -p 6379
127.0.0.1:6379> MQ CREATE orders MAXDELIVERY 5
OK
127.0.0.1:6379> MQ PUSH orders action process item_id 42
"1713394800000-0"
127.0.0.1:6379> MQ POP orders COUNT 1
1) 1) "1713394800000-0"
2) 1) "action" 2) "process" 3) "item_id" 4) "42"
127.0.0.1:6379> MQ ACK orders 1713394800000-0
(integer) 1
Next steps¶
- Configuration All CLI flags and options.
- Architecture How Moon works under the hood.
- Transactions Cross-store ACID transactions across KV, vector, and graph.
- Full-text search BM25, hybrid fusion, FT.AGGREGATE with GROUPBY/REDUCE.