Keydb.cfg //free\\ -

Do not use rename-command to obfuscate commands — use ACLs. Always set a requirepass in production. 8. Memory Management | Directive | Default | Description | |-----------|---------|-------------| | maxmemory | 0 | Max memory in bytes. 0 = unlimited. | | maxmemory-policy | noeviction | Eviction policy: volatile-lru , allkeys-lru , volatile-random , allkeys-random , volatile-ttl , noeviction . | | maxmemory-samples | 5 | Number of keys to sample for LRU/TTL. | | active-defrag | no | Enable online defragmentation. | | active-defrag-threshold-lower | 10 | Fragmentation % to start. | | active-defrag-threshold-upper | 100 | Fragmentation % to force. | | active-defrag-cycle-min | 5 | Minimum CPU % for defrag. | | active-defrag-cycle-max | 75 | Maximum CPU % for defrag. |

Increasing server-threads improves throughput on multi-core systems but may increase complexity. Start with cores/2. 5. General Operational Directives | Directive | Default | Description | |-----------|---------|-------------| | daemonize | no | Run as background process. | | pidfile | /var/run/keydb.pid | PID file location. | | loglevel | notice | Levels: debug, verbose, notice, warning. | | logfile | "" | Log file path. Empty = stdout. | | syslog-enabled | no | Log to syslog. | | databases | 16 | Number of logical databases. | | always-show-logo | no | Show KeyDB logo on startup. | | supervised | no | Integration with systemd/upstart. | 6. Persistence Options KeyDB supports both RDB snapshots and AOF (Append-Only File), exactly like Redis. 6.1 RDB (Snapshotting) | Directive | Example | Meaning | |-----------|---------|---------| | save | save 900 1 | Save if ≥1 key changed in 900 sec. | | save | save 300 10 | Save if ≥10 keys changed in 300 sec. | | stop-writes-on-bgsave-error | yes | Stop writes if background save fails. | | rdbcompression | yes | Compress string objects using LZF. | | rdbchecksum | yes | CRC64 checksum at end of RDB. | | dbfilename | dump.rdb | RDB file name. | | dir | ./ | Directory for RDB/AOF files. | 6.2 AOF (Append-Only File) | Directive | Default | Description | |-----------|---------|-------------| | appendonly | no | Enable AOF persistence. | | appendfilename | appendonly.aof | AOF file name. | | appendfsync | everysec | always , everysec , no . | | no-appendfsync-on-rewrite | no | Avoid fsync during rewrite. | | auto-aof-rewrite-percentage | 100 | Trigger rewrite if file grows 100%. | | auto-aof-rewrite-min-size | 64mb | Minimum size for rewrite. | | aof-load-truncated | yes | Load truncated AOF (on crash recovery). | | aof-use-rdb-preamble | yes | Use RDB at start of AOF (hybrid format). | keydb.cfg

Use both RDB (for backups) and AOF (for durability). Set appendfsync everysec for balance. 7. Security Directives | Directive | Default | Description | |-----------|---------|-------------| | requirepass | (empty) | Password for AUTH command. | | masterauth | (empty) | Password for replica → master auth. | | rename-command | (none) | Disable or rename dangerous commands (e.g., FLUSHALL ). | | aclfile | (none) | External ACL configuration file (KeyDB 6+). | Do not use rename-command to obfuscate commands — use ACLs

| Directive | Default | Description | |-----------|---------|-------------| | server-threads | 2 | Number of threads for handling client requests. | | server-thread-affinity | (none) | CPU core binding for server threads (e.g., 0-3 ). | | io-threads | 1 | Threads for I/O operations (reads/writes). | | io-threads-do-reads | no | Whether I/O threads also handle read commands. | | async-flush | no | Perform flush operations asynchronously. | | async-flush-threads | 4 | Threads for async flush. | Memory Management | Directive | Default | Description

Similar Posts