共计 1642 个字符,预计需要花费 5 分钟才能阅读完成。
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 不执行,操作系统本人同步数据 | |
正文完