194 lines
4.3 KiB
Plaintext
194 lines
4.3 KiB
Plaintext
# Redis configuration for my-uploader-bot
|
|
# Optimized for production use with caching and session storage
|
|
|
|
# Network configuration
|
|
bind 0.0.0.0
|
|
port 6379
|
|
tcp-backlog 511
|
|
timeout 300
|
|
tcp-keepalive 300
|
|
|
|
# General configuration
|
|
daemonize no
|
|
supervised no
|
|
pidfile /var/run/redis_6379.pid
|
|
loglevel notice
|
|
logfile ""
|
|
databases 16
|
|
|
|
# Security
|
|
# requirepass your_redis_password_here
|
|
# rename-command FLUSHDB ""
|
|
# rename-command FLUSHALL ""
|
|
# rename-command DEBUG ""
|
|
|
|
# Memory management
|
|
maxmemory 2gb
|
|
maxmemory-policy allkeys-lru
|
|
maxmemory-samples 5
|
|
|
|
# Persistence configuration
|
|
# RDB (Redis Database) snapshots
|
|
save 900 1
|
|
save 300 10
|
|
save 60 10000
|
|
stop-writes-on-bgsave-error yes
|
|
rdbcompression yes
|
|
rdbchecksum yes
|
|
dbfilename dump.rdb
|
|
dir /data
|
|
|
|
# AOF (Append Only File)
|
|
appendonly yes
|
|
appendfilename "appendonly.aof"
|
|
appendfsync everysec
|
|
no-appendfsync-on-rewrite no
|
|
auto-aof-rewrite-percentage 100
|
|
auto-aof-rewrite-min-size 64mb
|
|
aof-load-truncated yes
|
|
aof-use-rdb-preamble yes
|
|
|
|
# Slow log
|
|
slowlog-log-slower-than 10000
|
|
slowlog-max-len 128
|
|
|
|
# Latency monitoring
|
|
latency-monitor-threshold 100
|
|
|
|
# Client configuration
|
|
maxclients 10000
|
|
|
|
# Advanced configuration
|
|
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
|
|
stream-node-max-bytes 4096
|
|
stream-node-max-entries 100
|
|
|
|
# Active rehashing
|
|
activerehashing yes
|
|
|
|
# Client output buffer limits
|
|
client-output-buffer-limit normal 0 0 0
|
|
client-output-buffer-limit replica 256mb 64mb 60
|
|
client-output-buffer-limit pubsub 32mb 8mb 60
|
|
|
|
# Client query buffer limit
|
|
client-query-buffer-limit 1gb
|
|
|
|
# Protocol buffer limit
|
|
proto-max-bulk-len 512mb
|
|
|
|
# Frequency of background tasks
|
|
hz 10
|
|
|
|
# Dynamic HZ
|
|
dynamic-hz yes
|
|
|
|
# AOF rewrite incremental fsync
|
|
aof-rewrite-incremental-fsync yes
|
|
|
|
# RDB save incremental fsync
|
|
rdb-save-incremental-fsync yes
|
|
|
|
# Jemalloc background thread
|
|
jemalloc-bg-thread yes
|
|
|
|
# TLS Configuration (if needed)
|
|
# port 0
|
|
# tls-port 6380
|
|
# tls-cert-file redis.crt
|
|
# tls-key-file redis.key
|
|
# tls-ca-cert-file ca.crt
|
|
|
|
# Modules (if needed)
|
|
# loadmodule /path/to/module.so
|
|
|
|
# Custom configuration for my-uploader-bot
|
|
# Session storage database
|
|
# Database 0: General cache
|
|
# Database 1: Session storage
|
|
# Database 2: Upload queue
|
|
# Database 3: Blockchain cache
|
|
# Database 4: User activity
|
|
# Database 5: Rate limiting
|
|
# Database 6: Temporary data
|
|
# Database 7: Analytics
|
|
# Database 8-15: Reserved for future use
|
|
|
|
# Performance tuning for caching workload
|
|
# Optimize for read-heavy workload
|
|
replica-read-only yes
|
|
replica-serve-stale-data yes
|
|
replica-priority 100
|
|
|
|
# Memory usage optimization
|
|
# Use jemalloc for better memory management
|
|
# Disable transparent huge pages for better latency
|
|
|
|
# Monitoring and debugging
|
|
# Enable keyspace notifications for specific events
|
|
notify-keyspace-events "Ex"
|
|
|
|
# Client timeout for idle connections
|
|
# timeout 300 (already set above)
|
|
|
|
# TCP keepalive
|
|
# tcp-keepalive 300 (already set above)
|
|
|
|
# Background saving
|
|
# stop-writes-on-bgsave-error yes (already set above)
|
|
|
|
# Compression
|
|
# rdbcompression yes (already set above)
|
|
|
|
# Checksum
|
|
# rdbchecksum yes (already set above)
|
|
|
|
# Auto memory report
|
|
oom-score-adj no
|
|
|
|
# Disable some potentially dangerous commands in production
|
|
# rename-command SHUTDOWN SHUTDOWN_MYUPLOADER
|
|
# rename-command CONFIG CONFIG_MYUPLOADER
|
|
|
|
# Enable protected mode (default)
|
|
protected-mode yes
|
|
|
|
# Disable dangerous commands
|
|
# rename-command EVAL ""
|
|
# rename-command SCRIPT ""
|
|
|
|
# Set maximum memory usage warning
|
|
# When memory usage reaches 80% of maxmemory, log warnings
|
|
# This is handled by application monitoring
|
|
|
|
# Custom settings for upload service
|
|
# Optimize for frequent key expiration
|
|
active-expire-ratio 25
|
|
|
|
# Optimize for small objects (typical for session data)
|
|
# Already configured above with ziplist settings
|
|
|
|
# Enable lazy freeing for better performance
|
|
lazyfree-lazy-eviction yes
|
|
lazyfree-lazy-expire yes
|
|
lazyfree-lazy-server-del yes
|
|
replica-lazy-flush yes
|
|
|
|
# IO threading (Redis 6.0+)
|
|
# io-threads 4
|
|
# io-threads-do-reads yes
|
|
|
|
# THP (Transparent Huge Pages) recommendation
|
|
# echo never > /sys/kernel/mm/transparent_hugepage/enabled
|
|
# Add this to your system configuration
|
|
|
|
# Kernel overcommit memory setting
|
|
# echo 1 > /proc/sys/vm/overcommit_memory
|
|
# Add this to your system configuration |