easyai/redis.conf

74 lines
2.8 KiB
Plaintext
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Redis服务器配置
# 绑定IP地址
#解除本地限制 注释bind 127.0.0.1
#bind 127.0.0.1
# 服务器端口号
port 6379
#配置密码,不要可以删掉
# 设置当前数据库不是任何数据库的从库
replicaof no one
#这个配置不要会和docker -d 命令 冲突
# 服务器运行模式Redis以守护进程方式运行,默认为no改为yes意为以守护进程方式启动可后台运行除非kill进程改为yes会使配置文件方式启动redis失败如果后面redis启动失败就将这个注释掉
daemonize no
#当Redis以守护进程方式运行时Redis默认会把pid写入/var/run/redis.pid文件可以通过pidfile指定(自定义)
#pidfile /data/dockerData/redis/run/redis6379.pid
#默认为noredis持久化可以改为yes
appendonly yes
#当客户端闲置多长时间后关闭连接如果指定为0表示关闭该功能 # 增加到300秒或设为0禁用
timeout 300
# 服务器系统默认配置参数影响 Redis 的应用
maxclients 10000
# 减少到60秒更快检测连接问题
tcp-keepalive 60
#指定在多长时间内有多少次更新操作就将数据同步到数据文件可以多个条件配合分别表示900秒15分钟内有1个更改300秒5分钟内有10个更改以及60秒内有10000个更改
save 900 1
save 300 10
save 60 10000
# 按需求调整 Redis 线程数
tcp-backlog 511
# 设置Redis副本实例是否为只读模式
# no副本实例可以进行写操作这在某些场景下可以分担主实例的压力但需要谨慎使用以避免数据不一致
replica-read-only no
# 设置Redis最大内存达到时的数据淘汰策略
# noeviction当内存达到最大限制时Redis不会自动删除任何键这可能导致进一步的操作失败直到手动干预 # 当内存不足时,删除最近最少使用的键
maxmemory-policy noeviction
# 设置数据库数量这里设置为16个数据库
databases 16
# 启用 AOF, AOF常规配置
appendonly yes
# 改为由操作系统决定何时同步减少I/O压力
appendfsync no
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
# 慢查询阈值
slowlog-log-slower-than 10000
slowlog-max-len 128
# 以系统日志的方式输出日志
# syslog-enabled yes
#指定日志记录级别Redis总共支持四个级别debug、verbose、notice、warning默认为verbose
# loglevel verbose
# 日志输出文件默认为stdout也可以指定文件路径
# logfile stdout
# 日志文件
#logfile /var/log/redis/redis-server.log
# 系统内存调优参数
# 按需求设置
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64