The installation of Redis is described earlier, followed by a brief description of the Redis configuration parameters.
1.Redis General Configuration
Daemonize No # By default, Redis is not run in daemon form. Daemonize Configuration Items Control the way Redis operates
Pidfile/path/to/redis.pid #当以daemon形式运行时, Redis generates a PID file that is generated by default in/var/run/redis.pid
Bind 192.168.1.2 10.8.4.2 # Specifies the IP of the binding, can have more than one
Port 6379 #指定监听端口
Unixsocket/tmp/redis.sock #也可以监听socket
Unixsocketperm 755 #当监听socket时可以指定权限为755
Timeout 0 #当一个redis-client has not been requested to send to the server side, then the server side has the right to actively shut down the connection, you can set the "Idle Timeout Time" by timeout, 0 means never shut down.
Tcp-keepalive 0 #TCP连接保活策略, can be set by the Tcp-keepalive configuration item, in seconds, if set to 60 seconds, the server side will every 60 seconds to connect to idle clients to initiate an ACK request to check whether the client has been hung off, For unresponsive clients, their connections are closed. If set to 0, keepalive detection is not performed.
LogLevel Notice # Log level, there are four kinds of debug, verbose, notice, warning
LogFile "" #定义日志路径,
Syslog-identredis #如果希望日志打印到syslog中, controlled by syslog-enabled. In addition, Syslog-ident allows you to specify log flags in the syslog.
Syslog-facility Local0 # Specifies the syslog device, which can be either user or LOCAL0-LOCAL7
Databases #设置数据库的总数量
2.Redis Snapshot Configuration ( Rdb persistent)
Save 1 #表示每15分钟且至少有1个key改变 triggers a persistence
Save #表示每5分钟且至少有10个key改变, trigger a persistence
Save 10000 #表示每60秒至少有10000个key改变 to trigger a persistent
Save "" #这样可以禁用rdb持久化
Stop-writes-on-bgsave-error Yes #rdb持久化写入磁盘避免不了会出现失败的情况, Redis stops the write operation as soon as the default fails. If you feel it doesn't matter, then you can use this option to turn this feature off.
Rdbcompression Yes #是否要压缩
Rdbchecksum Yes #是否进行数据校验
Dbfilename Dump.rdb #定义快照文件的名字
Dir./#定义快照文件储存路劲
3.Redis Security-related configuration
Requirepassaminglinux #设置redis-server's password
Rename-command config aminglinux.config #将CONFIG命令更名为aminglinux. config to avoid mis-operation, but it is not recommended to enable this feature if AOF persistence is used
Rename-command config "" #也可以后面定义为空 so that the config command is forbidden
4.Redis Limiting related configurations
maxclients 10000 # Limit the maximum number of client connections
MaxMemory <bytes> #设定最大内存使用数, Unit is byte
Maxmemory-policy Volatile-lru #指定内存移除规则
The Maxmemory-samples 3 #LRU算法和最小TTL算法都并非是精确的算法, but the estimated value. So you can set the size of the sample. If Redis checks three keys by default and chooses which one is LRU, then you can change the number of this key sample.
5.Redis aof Persistence-related configuration
appendonly No # if is a Yes , then open aof Persistence of
Appendfilename "appendonly.aof" # Specify AOF file name
Appendfsync everysec #指定fsync () call pattern, there are three kinds of no (do not call Fsync), always (each write will call Fsync), everysec (call once per second Fsync). The first is the fastest, the second data is the safest, but the performance will be worse, the third is this scenario, the default is the third.
No-appendfsync-on-rewrite No # Set Yes to avoid disk IO blocking when write volume is very large
Auto-aof-rewrite-percentage #规定什么情况下会触发aof重写. The value is a scale, and 10 means that the override mechanism is triggered when the AoF file increases by 10%.
Auto-aof-rewrite-min-size 64MB #重写会有一个条件, is not less than 64Mb
6.Redis slow log-related configuration
for slow log, you can set two parameters, one is the execution length, the unit is milliseconds; The other is the length of the slow log, and when a new command is written to the log, the oldest one is removed from the command log queue.
Slowlog-log-slower-than 10000 #慢于10000ms则记录日志
Slowlog-max-len #日志长度
This article is from the Linux OPS blog, so be sure to keep this source http://zhumy.blog.51cto.com/11647651/1829288
Redis Configuration Explained