Carry の Blog Carry の Blog
首页
关于
  • Nginx
  • Prometheus
  • Iptables
  • Systemd
  • Firewalld
  • Docker
  • Sshd
  • DBA工作笔记
  • MySQL
  • Redis
  • TiDB
  • Elasticsearch
  • OpenClaw
  • Hermes Agent
  • Claude Code
  • MySQL8-SOP手册
  • MySQL实战45讲学习笔记
  • 分类
  • 标签
  • 归档
GitHub (opens new window)

Carry の Blog

好记性不如烂键盘
首页
关于
  • Nginx
  • Prometheus
  • Iptables
  • Systemd
  • Firewalld
  • Docker
  • Sshd
  • DBA工作笔记
  • MySQL
  • Redis
  • TiDB
  • Elasticsearch
  • OpenClaw
  • Hermes Agent
  • Claude Code
  • MySQL8-SOP手册
  • MySQL实战45讲学习笔记
  • 分类
  • 标签
  • 归档
GitHub (opens new window)
  • MySQL

  • Redis

  • Keydb

    • KeyDB 安装配置:号称吊打 Redis 的发行版
    • DragonflyDB 生产实践|58天稳定运行的轻量缓存方案
  • TiDB

  • MongoDB

  • Elasticsearch

  • Kafka

  • victoriametrics

  • BigData

  • Sqlserver

  • 数据库
  • Keydb
Carry の Blog
2022-03-10

KeyDB 安装配置:号称吊打 Redis 的发行版

KeyDB 是 Redis 的一个多线程分支,主打「同一份数据、多核并行处理」,在单机上用多线程 I/O 与多线程命令执行来提升吞吐。下面是它的 RPM 安装、配置文件要点和集群搭建步骤。

版本说明

本文写于 2022-03,基于当时活跃开发的 KeyDB。
现状说明:KeyDB 项目自 Snap Inc. 收购后开发已基本停滞,官方 GitHub 长期无实质性更新,不建议在新项目中选型;本文的多线程/FLASH 存储等设计思路仍有参考价值,但生产环境请优先评估 Redis 官方多线程 I/O(6.0+)或 Valkey(Redis 社区分支)等更活跃的替代方案。

wget https://download.keydb.dev/pkg/open_source/rpm/centos7/x86_64/keydb-latest-1.el7.x86_64.rpm

yum localintall keydb-latest-1.el7.x86_64.rpm
1
2
3
cat /data/keydb7001/keydb7001.conf

bind 192.0.2.11
protected-mode yes
port 7001
tcp-backlog 511
timeout 0
tcp-keepalive 0
daemonize yes
supervised no
pidfile "/data/keydb7001/keydb7001.pid"
loglevel notice
logfile "/data/keydb7001/keydb7001.log"
databases 16
always-show-logo yes
requirepass Cv88xO3SuVv0FSGI
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename "dump.rdb"
dir "/data/keydb7001/"
masterauth Cv88xO3SuVv0FSGI
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
slave-priority 100
maxclients 100000
maxmemory-policy allkeys-lfu
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
slave-lazy-flush no
appendonly yes
appendfilename "appendonly.aof"
appendfsync no
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble no
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
#client-output-buffer-limit slave 2048mb 1500mb 60
client-output-buffer-limit slave 0 0 0 
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes
repl-backlog-size 2500000kb
repl-timeout 5000
# Generated by CONFIG REWRITE
save 900 1 
save 300 10
save 60 10000
#add by mc@20201213 for memallc
activedefrag yes
active-defrag-ignore-bytes 500mb
active-defrag-threshold-lower 10
active-defrag-cycle-min 25
active-defrag-cycle-max 75
# rename-command CONFIG "ADMIN_CONFIG"
rename-command FLUSHALL "ADMIN_FLUSHALL"
rename-command FLUSHDB  "ADMIN_FLUSHDB"
rename-command KEYS     "ADMIN_KEYS"

maxmemory 10240mb
cluster-enabled yes
cluster-config-file "cluster-7001.conf"
cluster-node-timeout 5000
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
 cat /usr/lib/systemd/system/keydb7001.service
[Unit]
Description=Advanced key-value store
After=network.target
Documentation=https://docs.keydb.dev, man:keydb-server(1)
[Service]
Type=forking
ExecStart=/usr/bin/keydb-server /data/keydb7001/keydb7001.conf
ExecStop=/bin/kill -s TERM $MAINPID
PIDFile=/data/keydb7001/keydb-server.pid
TimeoutStopSec=0
Restart=always
User=keydb
Group=keydb
RuntimeDirectory=keydb
RuntimeDirectoryMode=2755
UMask=007
PrivateTmp=yes
LimitNOFILE=65535
PrivateDevices=yes
ProtectHome=yes
ReadOnlyDirectories=/
ReadWriteDirectories=-/data/keydb7001
ReadWriteDirectories=-/data/keydb7001
ReadWriteDirectories=-/data/keydb7001
NoNewPrivileges=true
CapabilityBoundingSet=CAP_SETGID CAP_SETUID CAP_SYS_RESOURCE
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
ProtectSystem=true
ReadWriteDirectories=-/etc/keydb
[Install]
WantedBy=multi-user.target
Alias=keydb.service
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#Keydb#Redis
上次更新: 8/27/2026

← Redis 的可用内存过高时的自动驱逐 key 策略详解 DragonflyDB 生产实践|58天稳定运行的轻量缓存方案→

最近更新
01
TiKV 也有"寿命":一次 795 天 tokio 定时器溢出 panic 的复盘与预警建设 原创
08-27
02
DragonflyDB 生产实践|58天稳定运行的轻量缓存方案 原创
08-27
03
Hermes Agent 实战 18|MySQL 8 生产 SOP 是怎么长出来的 原创
08-27
更多文章>
Theme by Vdoing
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式