For production, bind to specific internal IPs, enable keepalive, and set a reasonable timeout. 4. Threading Model (KeyDB-Specific) This is the core differentiator from Redis.
| 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. |
Without maxmemory , KeyDB will keep growing until system memory is exhausted. 9. Replication | Directive | Default | Description | |-----------|---------|-------------| | replicaof | (none) | replicaof <masterip> <masterport> | | masteruser | (none) | ACL user for replication (KeyDB 6+). | | replica-serve-stale-data | yes | Serve stale data when disconnected from master. | | replica-read-only | yes | Replica accepts only reads. | | repl-diskless-sync | no | Transfer RDB directly to replicas (no disk). | | repl-diskless-sync-delay | 5 | Wait for more replicas before sync. | | repl-backlog-size | 1mb | Backlog for partial resync. | | min-replicas-to-write | 0 | Minimum replicas online to accept writes. | | min-replicas-max-lag | 10 | Max lag (seconds) for above condition. | 10. KeyDB-Specific Replication Enhancements | Directive | Default | Description | |-----------|---------|-------------| | active-replica | no | Allow replica to accept writes (multi-master-like). | | active-replica-lag | 100 | Max acceptable lag for active replica writes. |
port 6379 daemonize yes Many settings can be changed at runtime using CONFIG GET and CONFIG SET without restarting KeyDB. 3. Network Configuration | Directive | Default | Description | |-----------|---------|-------------| | bind | 127.0.0.1 | Network interfaces to listen on. Use 0.0.0.0 for all. | | port | 6379 | TCP port. Set to 0 to disable TCP. | | tcp-backlog | 511 | Connection backlog size. | | timeout | 0 | Idle connection timeout (seconds). 0 = never. | | tcp-keepalive | 300 | TCP keepalive interval. | | protected-mode | yes | Blocks external access if no bind/password set. | | unixsocket | (none) | Path for Unix socket. | | unixsocketperm | 700 | Permissions for Unix socket. |
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+). |
