You’ve been running a six-node Redis Cluster for two years. The cache works. The operational story does not: every release cycle the platform team is debugging a different MOVED/ASK edge case, the multi-key Lua scripts always need hash tags retrofitted, and your single hottest key (a global rate-limit bucket) is pinned to one shard so two of your six nodes are running cold. Someone forwards you a Dragonfly benchmark claiming millions of ops/sec from a single process and you wonder if you should consolidate six shards into one big vertical node. The answer is “maybe” — and the maybe is what this article is about.
What’s happening
Dragonfly is a single-process, multi-threaded in-memory data store that speaks the Redis and Memcached wire protocols. It’s not a Redis fork — it’s a clean-room implementation written in C++ using a shared-nothing thread architecture (each thread owns a slice of the keyspace, like an in-process sharded cluster). Operationally that means:
- One process, many threads. A 32-core box with 256 GB of RAM can run as a single Dragonfly instance with no cluster wiring. Redis on the same hardware needs Cluster mode and 30+ shards to use all cores.
- No MOVED/ASK redirections. Clients talk to one endpoint. Multi-key operations across “shards” are handled by Dragonfly internally.
- Reduced operational surface. No
cluster nodes, noredis-cli --cluster create, no slot migration runbook. One config file, one systemd unit.
Where it doesn’t fit:
- No replication topology yet matching Redis Cluster’s automatic failover semantics. Dragonfly supports replication and Sentinel-compatible failover; it does not have the full Cluster spec with sharded slots and automatic re-sharding the way Redis Cluster does. If your business case is “scale out horizontally beyond what one node can hold in RAM,” Redis Cluster or Valkey still wins.
- The capacity ceiling is the biggest node you’re willing to operate. Dragonfly’s model assumes you scale up. If you’ve got a 5 TB working set across 30 shards in Redis Cluster, consolidating onto a single instance means buying or renting a single machine with 5 TB of RAM. That’s an operational decision, not just a cost one — that’s a node that can’t be replaced quickly when it fails.
- Some Redis commands are not (yet) supported, particularly Cluster-specific ones (
CLUSTER NODES,CLUSTER SLOTS, etc.) — applications that introspect cluster topology need adjustment. Most client libraries’ standalone code path works unchanged. - Pub/Sub and Lua scripts are supported but with different performance characteristics. Test your hot scripts.
The honest answer on when Dragonfly makes sense: when your workload fits comfortably on one big node (with a hot replica on standby), when your client code is already single-endpoint and just happens to talk to a cluster behind a proxy, and when you’d rather operate one beefy server than six commodity ones. If you’ve already invested in cluster-aware clients and your working set is genuinely beyond a single node’s capacity, stay on Redis Cluster or Valkey Cluster.
How to verify
After the installer runs:
# Basic health
redis-cli --tls \
--cacert /etc/dragonfly/tls/ca.crt \
--cert /etc/dragonfly/tls/dragonfly.crt \
--key /etc/dragonfly/tls/dragonfly.key \
-h 10.40.0.11 -p 6379 \
--user admin -a "$ADMIN_PASS" \
ping
# PONG
# Server info — should report "df-vX.Y.Z"
redis-cli --tls ... info server | grep -E 'dragonfly_version|process_id|tcp_port'
Memory and thread layout:
redis-cli --tls ... info memory
redis-cli --tls ... info stats | grep -E 'total_connections|total_commands'
# Dragonfly-specific:
redis-cli --tls ... dfly thread_info
Replica health (if you’ve set up a replica):
redis-cli --tls ... -h <replica-ip> -p 6379 \
--user admin -a "$ADMIN_PASS" \
info replication
# role:replica
# master_link_status:up
# master_last_io_seconds_ago: <something low>
The fix
Save the script as /root/setup-dragonfly.sh and run it on the primary and (optionally) the replica node. The installer covers Ubuntu 22.04: base hardening (UFW, fail2ban, unattended-upgrades, SSH key-only), kernel/sysctl tuning, the official Dragonfly DEB from GitHub releases, TLS material from a local CA, dragonfly.conf-equivalent flags via systemd EnvironmentFile, ACL users, and a one-shot replication setup if IS_REPLICA=true.
#!/usr/bin/env bash
set -euo pipefail
### Ubuntu 22.04 Dragonfly installer (Redis-protocol compatible)
### Run on the primary, then optionally on a replica with IS_REPLICA=true
### Internal listener only; cloud firewall must block 6379 from anywhere outside your private CIDR
if [[ "$(id -u)" -ne 0 ]]; then
echo "Run as root."
exit 1
fi
# === EDIT PER NODE ===
NODE_NAME="dragonfly-1" # dragonfly-1 (primary) or dragonfly-2 (replica)
NODE_IP="10.40.0.11"
IS_REPLICA="false" # true on the replica node only
PRIMARY_IP="10.40.0.11" # IP of the primary (same as NODE_IP on primary itself)
ADMIN_PASS="CHANGE_ME_ADMIN"
APP_PASS="CHANGE_ME_APP"
REPL_PASS="CHANGE_ME_REPL"
INTERNAL_CIDR="10.40.0.0/16"
DRAGONFLY_VERSION="1.21.2"
MAXMEMORY="32gb"
# =====================
echo
echo "========================================"
echo "Dragonfly node ${NODE_NAME} (${NODE_IP})"
echo "========================================"
echo
echo "==> Updating base OS"
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get -y upgrade
apt-get -y install curl ca-certificates ufw fail2ban unattended-upgrades \
openssl jq net-tools redis-tools vim lsof tcpdump bind9-host
echo "==> Time sync"
timedatectl set-ntp true || true
echo "==> Kernel/sysctl tuning"
cat > /etc/sysctl.d/99-dragonfly.conf <<'SYSCTL'
vm.overcommit_memory = 1
vm.swappiness = 1
net.core.somaxconn = 4096
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_syncookies = 1
net.ipv4.ip_local_port_range = 10240 65535
fs.file-max = 1048576
SYSCTL
sysctl --system
echo "==> Disable transparent hugepages"
cat > /etc/systemd/system/disable-thp.service <<'THP'
[Unit]
Description=Disable Transparent Huge Pages
After=sysinit.target local-fs.target
[Service]
Type=oneshot
ExecStart=/bin/bash -c 'echo never > /sys/kernel/mm/transparent_hugepage/enabled; echo never > /sys/kernel/mm/transparent_hugepage/defrag'
RemainAfterExit=yes
[Install]
WantedBy=basic.target
THP
systemctl daemon-reload
systemctl enable --now disable-thp
echo "==> dragonfly user + dirs"
id -u dragonfly &>/dev/null || useradd --system --no-create-home --shell /usr/sbin/nologin dragonfly
mkdir -p /var/lib/dragonfly /var/log/dragonfly /etc/dragonfly /etc/dragonfly/tls
chown -R dragonfly:dragonfly /var/lib/dragonfly /var/log/dragonfly
cat > /etc/security/limits.d/99-dragonfly.conf <<'LIMITS'
dragonfly soft nofile 200000
dragonfly hard nofile 200000
dragonfly soft nproc 65535
dragonfly hard nproc 65535
LIMITS
echo "==> Hardening SSH"
sed -i 's|^[#[:space:]]*PermitRootLogin.*|PermitRootLogin prohibit-password|' /etc/ssh/sshd_config
sed -i 's|^[#[:space:]]*PasswordAuthentication.*|PasswordAuthentication no|' /etc/ssh/sshd_config
sshd -t && systemctl restart ssh
echo "==> UFW — internal only"
ufw default deny incoming
ufw default allow outgoing
ufw allow 22/tcp
ufw allow from "${INTERNAL_CIDR}" to any port 6379 proto tcp
ufw --force enable
echo "==> fail2ban"
cat > /etc/fail2ban/jail.d/sshd.local <<'FAIL2BAN'
[sshd]
enabled = true
port = ssh
backend = systemd
maxretry = 4
findtime = 10m
bantime = 1h
FAIL2BAN
systemctl enable --now fail2ban
echo "==> Unattended security upgrades"
cat > /etc/apt/apt.conf.d/20auto-upgrades <<'AUTOUPG'
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
APT::Periodic::AutocleanInterval "7";
AUTOUPG
echo "==> Downloading Dragonfly ${DRAGONFLY_VERSION}"
ARCH="$(uname -m)"
case "${ARCH}" in
x86_64) DEB_ARCH="amd64" ;;
aarch64) DEB_ARCH="arm64" ;;
*) echo "Unsupported arch ${ARCH}"; exit 2 ;;
esac
cd /tmp
curl -fSL -o dragonfly.deb \
"https://github.com/dragonflydb/dragonfly/releases/download/v${DRAGONFLY_VERSION}/dragonfly_${DRAGONFLY_VERSION}_${DEB_ARCH}.deb"
apt-get install -y ./dragonfly.deb
rm -f dragonfly.deb
systemctl stop dragonfly || true
echo "==> TLS material"
cd /etc/dragonfly/tls
if [[ "${IS_REPLICA}" != "true" && ! -f ca.crt ]]; then
openssl req -x509 -newkey rsa:4096 -sha256 -nodes -days 3650 \
-keyout ca.key -out ca.crt \
-subj "/CN=Dragonfly CA"
chmod 600 ca.key
fi
if [[ ! -f dragonfly.crt ]]; then
if [[ ! -f ca.crt || ! -f ca.key ]]; then
echo "ERROR: copy ca.crt + ca.key from the primary to /etc/dragonfly/tls/ before running on the replica." >&2
exit 2
fi
openssl req -newkey rsa:2048 -nodes \
-keyout dragonfly.key -out dragonfly.csr \
-subj "/CN=${NODE_NAME}" \
-addext "subjectAltName=DNS:${NODE_NAME},IP:${NODE_IP},IP:127.0.0.1"
cat > dragonfly.ext <<EXT
subjectAltName=DNS:${NODE_NAME},IP:${NODE_IP},IP:127.0.0.1
extendedKeyUsage=serverAuth,clientAuth
EXT
openssl x509 -req -in dragonfly.csr -CA ca.crt -CAkey ca.key -CAcreateserial \
-out dragonfly.crt -days 825 -sha256 -extfile dragonfly.ext
chmod 640 dragonfly.key
chown root:dragonfly dragonfly.crt dragonfly.key ca.crt
fi
cd -
echo "==> Writing ACL file"
cat > /etc/dragonfly/users.acl <<EOF
USER default OFF NOPASS NOCOMMANDS
USER admin ON >${ADMIN_PASS} ~* +@all
USER app ON >${APP_PASS} ~* -@dangerous -FLUSHDB -FLUSHALL -KEYS -DEBUG -SHUTDOWN -SCRIPT +@all
USER replication ON >${REPL_PASS} +@all ~*
EOF
chmod 640 /etc/dragonfly/users.acl
chown root:dragonfly /etc/dragonfly/users.acl
echo "==> Writing /etc/dragonfly/dragonfly.flags"
cat > /etc/dragonfly/dragonfly.flags <<EOF
# Dragonfly command-line flags — consumed by the systemd unit override below.
--bind=${NODE_IP}
--port=6379
--tls
--tls_cert_file=/etc/dragonfly/tls/dragonfly.crt
--tls_key_file=/etc/dragonfly/tls/dragonfly.key
--tls_ca_cert_file=/etc/dragonfly/tls/ca.crt
--requirepass=${ADMIN_PASS}
--aclfile=/etc/dragonfly/users.acl
--dir=/var/lib/dragonfly
--logtostderr
--maxmemory=${MAXMEMORY}
--cache_mode=true
--proactor_threads=0
--snapshot_cron="*/30 * * * *"
--dbfilename=dump
--save_schedule="*/30 * * * *"
EOF
chmod 640 /etc/dragonfly/dragonfly.flags
chown root:dragonfly /etc/dragonfly/dragonfly.flags
echo "==> systemd unit"
cat > /etc/systemd/system/dragonfly.service <<'DRAGON'
[Unit]
Description=Dragonfly in-memory data store
After=network.target
[Service]
Type=simple
User=dragonfly
Group=dragonfly
EnvironmentFile=-/etc/dragonfly/env
ExecStart=/bin/bash -c '/usr/bin/dragonfly $(grep -v "^#" /etc/dragonfly/dragonfly.flags | xargs)'
Restart=on-failure
LimitNOFILE=200000
TimeoutStopSec=60
KillMode=process
[Install]
WantedBy=multi-user.target
DRAGON
systemctl daemon-reload
systemctl enable dragonfly
systemctl start dragonfly
echo "==> Waiting for Dragonfly to accept TLS connections"
for i in {1..60}; do
if redis-cli --tls \
--cacert /etc/dragonfly/tls/ca.crt \
--cert /etc/dragonfly/tls/dragonfly.crt \
--key /etc/dragonfly/tls/dragonfly.key \
-h "${NODE_IP}" -p 6379 \
-a "${ADMIN_PASS}" ping >/dev/null 2>&1; then
echo " Dragonfly up."
break
fi
sleep 2
done
if [[ "${IS_REPLICA}" == "true" ]]; then
echo "==> Configuring replica → primary ${PRIMARY_IP}"
redis-cli --tls \
--cacert /etc/dragonfly/tls/ca.crt \
--cert /etc/dragonfly/tls/dragonfly.crt \
--key /etc/dragonfly/tls/dragonfly.key \
-h "${NODE_IP}" -p 6379 \
-a "${ADMIN_PASS}" \
config set masterauth "${REPL_PASS}"
redis-cli --tls \
--cacert /etc/dragonfly/tls/ca.crt \
--cert /etc/dragonfly/tls/dragonfly.crt \
--key /etc/dragonfly/tls/dragonfly.key \
-h "${NODE_IP}" -p 6379 \
-a "${ADMIN_PASS}" \
replicaof "${PRIMARY_IP}" 6379
fi
echo
echo "========================================"
echo "DONE"
echo "========================================"
echo
echo "Listeners:"
ss -lntp | grep ':6379\b' || true
echo
echo "Server info:"
redis-cli --tls \
--cacert /etc/dragonfly/tls/ca.crt \
--cert /etc/dragonfly/tls/dragonfly.crt \
--key /etc/dragonfly/tls/dragonfly.key \
-h "${NODE_IP}" -p 6379 \
-a "${ADMIN_PASS}" info server | head -20
Run on the primary, then on the replica with IS_REPLICA=true and PRIMARY_IP set correctly:
chmod 700 /root/setup-dragonfly.sh
/root/setup-dragonfly.sh
After both are up, the replica should report role:replica and master_link_status:up within seconds. Do a write on the primary and read from the replica to confirm propagation:
redis-cli --tls ... -h <primary> -p 6379 -a "$ADMIN_PASS" set rep:test "ok"
redis-cli --tls ... -h <replica> -p 6379 -a "$ADMIN_PASS" get rep:test
A few things worth flagging before you ship application traffic at this:
- Snapshots happen on a schedule (
--snapshot_cron). There is no AOF the way Redis has — Dragonfly’s persistence is RDB-style. If you need write-after-write durability, run a replica and assume worst-case loss of one snapshot interval. - Client side: use the standalone Redis client, not the cluster client.
redis.Redis(...)in Python, notRedisCluster(...). If you’re migrating from Redis Cluster you may need to remove cluster-aware wrappers from your code. - Lua scripts work, but performance characteristics differ. Benchmark your hottest scripts before declaring victory on a migration.
- Memcached protocol support is on by default on a separate port if you enable it; leave it off if you don’t need it.
For a Dragonfly tier we operate alongside your application, Cloud Compute plus Managed Cloud Ops covers patching, capacity, and on-call — book a scoping call to plan the migration off Redis Cluster.