Change your application: migrate from Redis to KiviDB
Client libraries connect to KiviDB unchanged: redis-cli, redis-py, ioredis, node-redis, go-redis, Jedis, Lettuce, StackExchange.Redis and redis-rs all work…
Client libraries connect to KiviDB unchanged: redis-cli, redis-py, ioredis, node-redis, go-redis, Jedis, Lettuce, StackExchange.Redis and redis-rs all work. What changes is the host, the port, the password, and for KiviDB Cloud the user and TLS.
Connection strings
# Before
REDIS_URL=redis://:password@redis.internal:6379/0
# After, self-hosted
REDIS_URL=redis://:password@kividb.internal:6380/0
# After, KiviDB Cloud with TLS
REDIS_URL=rediss://kividbapp:password@your-name.cloud.kividb.io:6380/0
Python (redis-py)
import os, redis
# Before: Sentinel
from redis.sentinel import Sentinel
sentinel = Sentinel([("sentinel-1.internal", 26379)], socket_timeout=0.5)
r = sentinel.master_for("mymaster", password=os.environ["REDIS_PASSWORD"])
# After: KiviDB Cloud
r = redis.Redis(
host="your-name.cloud.kividb.io",
port=6380,
username="kividbapp",
password=os.environ["KIVIDB_PASSWORD"],
ssl=True,
ssl_ca_certs="kividb-ca.pem",
)
Node.js (ioredis)
import fs from "node:fs";
import Redis from "ioredis";
// Before
const redis = new Redis({ host: "redis.internal", port: 6379, password: process.env.REDIS_PASSWORD });
// After: KiviDB Cloud
const redis = new Redis({
host: "your-name.cloud.kividb.io",
port: 6380,
username: "kividbapp",
password: process.env.KIVIDB_PASSWORD,
tls: { ca: fs.readFileSync("kividb-ca.pem") },
});
// From Redis Cluster to a KiviDB cluster: the cluster client stays
const cluster = new Redis.Cluster([{ host: "kividb-node-1.internal", port: 6380 }], {
redisOptions: { password: process.env.KIVIDB_PASSWORD },
});
Go (go-redis)
rdb := redis.NewClient(&redis.Options{
Addr: "your-name.cloud.kividb.io:6380",
Username: "kividbapp",
Password: os.Getenv("KIVIDB_PASSWORD"),
TLSConfig: &tls.Config{RootCAs: pool, ServerName: "your-name.cloud.kividb.io"}, // pool holds kividb-ca.pem
})
Java (Jedis)
// Before: JedisSentinelPool pool = new JedisSentinelPool("mymaster", sentinels, password);
JedisPooled jedis = new JedisPooled(
new HostAndPort("kividb.internal", 6380),
DefaultJedisClientConfig.builder().password(System.getenv("KIVIDB_PASSWORD")).build());
Connect to KiviDB Cloud by hostname, not by IP address: the certificate is issued for the name.
Check what the application sends. Run the test suite against KiviDB first.
A command KiviDB lacks answers ERR unknown command; the default build answers
scripting commands with an error that names the lua build.