port 6379 # 监听端口 bind 0.0.0.0 # 监听地址 protected-mode no # Protected-mode 禁止公网访问redis cache daemonize yes # 是否以守护进程方式启动 timeout 300 # 客户端连接的超时时间,单位为秒,超时后会关闭连接,0永不超时 tcp-keepalive 60 # 服务端主动向空闲的客户端发起ack请求,以判断连接是否有效 databases 20 # 设置数据库数量,默认数据库为0 maxclients 2000 # 设置最大连接数,0为不限制 slowlog-log-slower-than 10000 slowlog-max-len 128 tcp-backlog 511 supervised no pidfile /var/run/redis_6379.pid loglevel notice #日志级别,分别有: # debug :适用于开发和测试 # verbose :更详细信息 # notice :适用于生产环境 # warning :只记录警告或错误信息 logfile "/var/redis/log/6379.log" save 900 1 save 300 10 save 60 10000 stop-writes-on-bgsave-error yes rdbcompression yes rdbchecksum yes dbfilename dump.rdb dir ./ 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 maxmemory-policy allkeys-lru appendonly yes # AOF持久化,是否记录更新操作日志,默认redis是异步(快照)把数据写入本地磁盘 appendfilename "6379.aof" # 指定更新日志文件名 appendfsync everysec # everysec 默认方式,每秒同步一次到appendonly.aof # always 每次有数据发生变化时都会写入 # no 不同步,数据不会持久化 no-appendfsync-on-rewrite no # 当AOF日志文件即将增长到指定百分比时,redis通过调用BGREWRITEAOF是否自动重写AOF日志文件 auto-aof-rewrite-percentage 100 auto-aof-rewrite-min-size 64mb aof-load-truncated yes lua-time-limit 5000 cluster-enabled yes cluster-config-file nodes-6379.conf 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 256mb 64mb 60 client-output-buffer-limit pubsub 32mb 8mb 60 hz 10 aof-rewrite-incremental-fsync yes requirepass 123456