Redis.conf分析

Redis.conf

单位
配置文件对大小写不敏感
# 1k => 1000 bytes
# 1kb => 1024 bytes
# 1m => 1000000 bytes
# 1mb => 1024*1024 bytes
# 1g => 1000000000 bytes
# 1gb => 1024*1024*1024 bytes

…………
包含
# include /path/to/local.conf
# include /path/to/other.conf


…………
bind 127.0.0.1		绑定的ip

protected-mode yes		保护模式

port 6379		端口

################################# GENERAL #####################################

daemonize yes		守护进程方式运行,默认no


pidfile /www/server/redis/redis.pid		如果以后台方式运行,要指定pid

# Specify the server verbosity level.
# This can be one of:
# debug (a lot of information, useful for development/testing)
# verbose (many rarely useful info, but not a mess like the debug level)
# notice (moderately verbose, what you want in production probably)默认,生产环境
# warning (only very important / critical messages are logged)
loglevel notice
logfile "/www/server/redis/redis.log"		位置




# dbid is a number between 0 and 'databases'-1
databases 16		默认16个数据库


持久化,redis是内存数据库,断电即失
save 900 1		如果900s内至少有一个key修改,进行持久化操作
save 300 10
save 60 10000
    
    
stop-writes-on-bgsave-error yes		持久化出错,是否继续工作
    
    
rdbcompression yes		是否压缩 rdb 文件,要消耗一定的cpu资源
    
rdbchecksum yes		保存 rdb 文件 是否要校验
    
dbfilename dump.rdb		rdb 文件保存目录
    
    
################################# REPLICATION #################################

 
    
################################# SECURITY #################################
# requirepass foobared		设置密码
    
    
################################### CLIENTS ####################################
# maxclients 10000		最大的连接数

############################## MEMORY MANAGEMENT################################
# maxmemory <bytes>		最大的容量
    
# maxmemory-policy noeviction		内存满了怎么处理
  
    
############################## APPEND ONLY MODE ###############################
aof的配置
    
appendonly no		默认不开启,默认rdb够用了

appendfilename "appendonly.aof"			持久化的文件的名字

# appendfsync always		每次都要  sync
appendfsync everysec		每秒执行一次  sync  可能会丢失一秒的数据
# appendfsync no			不执行,操作系统自己同步数据


posted @ 2021-07-20 23:42  Ricardo_ML  阅读(46)  评论(0编辑  收藏  举报