# Redis 远程服务器配置 # 用于生产环境的 Redis 配置 # 绑定所有网络接口(允许远程连接) bind 0.0.0.0 # 保护模式关闭(允许远程连接,但必须配置密码) protected-mode yes # 端口 port 6379 # 密码认证(必须配置!) requirepass ${REMOTE_DB_REDIS_PASSWORD} # 持久化配置 appendonly yes appendfilename "appendonly.aof" # AOF 同步策略 appendfsync everysec # RDB 快照 save 900 1 save 300 10 save 60 10000 # 数据库文件名 dbfilename dump.rdb # 工作目录 dir /data # 最大内存(根据服务器配置调整) maxmemory 2gb maxmemory-policy allkeys-lru # 日志级别 loglevel notice logfile "" # 慢查询日志 slowlog-log-slower-than 10000 slowlog-max-len 128 # 客户端连接配置 timeout 300 tcp-keepalive 300 maxclients 10000 # 安全配置 # 禁用危险命令 rename-command FLUSHDB "" rename-command FLUSHALL "" rename-command CONFIG "" # 开启 RDB 和 AOF 压缩 rdbcompression yes rdbchecksum yes # AOF 重写配置 auto-aof-rewrite-percentage 100 auto-aof-rewrite-min-size 64mb