2.0-redis configuration explanation (top)

Source: Internet
Author: User
Tags syslog

Redis View Configuration

#redis-CLI

127.0.0.1:6379>config Get * #查看所有的配置项

127.0.0.1:6379>CONFIG Get timeout #查看timeout配置项

1) "Timeout"

2) "300"

127.0.0.1:6379>CONFIG set timeout 0 #重设timeout配置项

Ok

127.0.0.1:6379>config Get Timeout

1) "Timeout"

2) "0"


Redis View Configuration

daemonize No # By default, Redis is not run in daemon form. The Daemonize configuration item allows you to control the way Redis runs. Yes indicates background run, no is foreground run


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 bound IP, which can have multiple, separated spaces .


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 if the client has been hung, and the unresponsive client closes its connection. If set to 0, keepalive detection is not performed.


LogLevel Notice # Log level, there are four kinds of debug, verbose, notice, warning


logfile "" #定义日志路径,


Syslog-ident Redis #如果希望日志打印到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 #设置数据库的总数量, select N selects the database with a total of 0-15


Redis Snapshot configuration (Rdb persistence)

Save 1 #表示每15分钟且至少有1个key改变 triggers a persistence

Save #表示每5分钟且至少有10个key改变, trigger a persistence

Save 10000 #表示每60秒至少有10000个key改变 trigger a persistence

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 ./#定义快照文件储存路径


Redis Security-related configuration

Requirepass aminglinux #设置redis-server password, this time login redis-cli-a aminglinux

, or log in, the operation will be prompted to verify the failure.

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


Redis Throttling Related configuration

MaxClients 10000 #限制最大客户端连接数

MaxMemory <bytes> #设定最大内存使用数, Unit is byte

Maxmemory-policy Volatile-lru #指定内存移除规则, when memory is low, use the LRU algorithm to expire old data

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.


2.0-redis configuration explanation (top)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.