Redis configuration file redis.conf parameter details

Source: Internet
Author: User
Tags allkeys delete key

redis.conf configuration file Parameters detailed

# redis configuration file example.########################################## general  ####################################### #daemonize  yes     #是否开启在后台运行redis, default to No, Does not open the pidfile /var/run/redis/redis.pid     #redis在后台运行时, the default PID file storage path and file name port 6379      #redis运行监听端口号, default 6379tcp-backlog 511     #listen队列的长度, This bind 127.0.0.1     with the system itself #绑定IP地址unixsocket  /tmp/redis.sock      #unix指定监听socketunixsocketperm  755     #当指定监听为socket时, you can specify that their permissions are 755timeout 0      #设置客户端连接时的超时时间 units in seconds. When the client does not issue any instructions during this time, the connection is closed, and 0 is off this setting tcp-keepalive 0     #TCP   KeepAlive. If the value is non-0, when the link is lost, the tcp acks is sent to the client using So_keepalive. This parameter has two functions: 1. Detect breakpoints; 2. From the network intermediary device, it is to keep the link. On Linux, the set time is the period of sending ACKs. Note: The link will not be closed until the double set time is reached. On other cores, the cycle depends on the kernel settings. A more reasonable value is 60sloglevel notice     #指定日志级别, debugfor development/testing; verbose not debug so detailed; notice is suitable for production lines, warning only records very important information logfile /var/log/redis/redis.log      #日志文件名, and the path database 16     #默认值为16, the default database is 0, and the database range is between 0-(database-1) ######### ############################# snapshotting######################################## #save  900 1       #15分钟内有至少1个键被更改则进行快照 #save 300 10      # Take a snapshot of at least 10 keys changed in 5 minutes #save 60 10000     #一分钟内有至少10000个键被更改则进行快照save   ""          #表示禁用RDB持久化stop-writes-on-bgsave-error yes    # Indicates if an error occurred while writing to the disk, whether to stop writing, yes, stop, no to continue. rdbcompression yes     #表示是否要压缩RDBrdbchecksum  yes    # Indicates whether the data is verified dbfilename dump.rdb     #默认RDB持久化备份文件名dir  /var/lib/redis/      #定义RDB存放路径slaveof  <masterip> <masterport>     #主从复制When this machine is slave, configure masterauth <master-password>    # Configures the slave-serve-stale-data yes     #当slave和master丢失链接 when the host requires password authentication, or is in the process of synchronizing, responding to client requests, Set to Yes to indicate a response, set to No, and return directly to "Sync with master in progress" (in sync with primary server) Slave-read-only yes      #设置slave是否为只读repl-diskless-sync no     #disk较慢, and when the network is fast, You can use disklessrepl-diskless-sync-delay 5     #设置成0的话, transfer to start Asaprepl-disable-tcp-nodelay  no     #SYNC完毕后, close tcp_nodelay in slave socket, if yes,reids send a small number of TCP packets to Slave, However, it may result in a data delay of up to 40ms, which, if no, may consume a small amount of bandwidth at the time of replication, by default we set it to no for low-latency optimizations, and if there is a lot of network jumps between master and slave, set it to Yes REPL-BACKLOG-SIZE&NBSP;100MB      #值越大, the longer salve can be lost. repl-backlog-ttl 3600     #多久释放backlog, how long to release when confirming that master no longer needs slave. 0 is never released. slave-priority 100     #当master不可用, Sentinel will elect a master based on the priority of slave. The lowest priority slave, elected Master. and configured to 0, will never be elected. (Must be ≥0). Default is 100requirepass foobared     #设置客户端连接密码 because Redis responds at 100w times per second, so passwords are particularly complex rename-command config   ""      #命令重新命名, or disable; Rename command is an empty string can disable some dangerous commands such as: Flushall Delete all data, it is important to note that A command alias written to the AoF file or routed to slave may cause some problems maxclients 10000     #设置最多链接客户端数量, default is 10000; The actual number of requests that can be accepted is the set value minus 32, which is the maxmemory <bytes>     #设置最大使用内存数量 that Redis retains for internal file descriptors. This is especially useful when Redis is used as an LRU cache. The value you set is smaller than the value that the system can use, because when the delete algorithm is enabled, the slave output cache also consumes memory when the maximum memory limit is used, which is the deletion algorithm #volatile-lru    ->    Using the LRU algorithm to remove key#allkeys-lru     ->   with outdated Peugeot removes any key# using the LRU algorithm volatile-random ->   randomly removes a key#allkeys-random  ->   with an outdated Peugeot to randomly remove a key# volatile-ttl    ->   remove the most recently expired key#noeviction ->        do not delete key, when there is a write request, return error maxmemory-policy volatile-lru# default setting is volatile-lrumaxmemory-samples3      #LRU和minimal  TTL  algorithms areNot a precise algorithm, but a relatively accurate algorithm (in order to save memory), you can choose the sample size to detect. Redis default selects 3 samples for detection appendonly no     #默认情况下, Redis does not open aof mode of persistence, Turn on aof persistence needs to change No to yesappendfilename  "appendonly.aof"     aof save name, default is appendonly.aof#  redis supports three different modes:redis supports three types of aof file persistence strategies: # no: don ' t  fsync, just let the os flush the data when it wants.  Faster. #表示由操作系统决定何时写入. Best performance, but lowest reliability # always: fsync after every write to the append only  log. slow, safest. Indicates that each disk is written to. The worst performance, some # everysec: fsync only one time every second.  than the above security Compromise. Indicates that writes are performed once per second. Compromise, recommended appendfsync everysec     #AOF持久化方案, select Everysec, write once per second No-appendfsync-on-rewrite  no     #设置为yes表示rewrite期间对新写操作不fsync, temporarily present in memory, and then write after rewrite is complete. auto-aof-rewrite-percentage 100# specifies the criteria for Redis overriding the AoF file, which defaults to100, which indicates that background rewrite is triggered when the current aof file grows more than 100% of the last aof file size compared to the aof file size of the last rewrite. If configured to 0, automatic rewrite is disabled. AUTO-AOF-REWRITE-MIN-SIZE&NBSP;64MB Specifies the size of the aof file that triggers rewrite. If the aof file is less than this value, automatic rewrite is not triggered even if the current file's increment ratio reaches the Auto-aof-rewrite-percentage configuration value. The rewrite is triggered when both configuration items are met at the same time. # aof Automatic override (merge command, reduce log size) #  when aof log size increases to a specific ratio, Redis calls bgrewriteaof automatically rewrite the log file #  Principle: Redis records the file size of the AoF file after the last rewrite. #  If you have just started, the aof size #  This base size is used to compare with the current size when you start the record. If the current size is larger than a specific ratio, the override is triggered. #  You also need to specify a minimum value that the AOF needs to be overridden, which avoids reaching the ratio. #  but the aof file is also very small in the case of rewriting the AoF file, set to 0 to disable auto-override aof-load-truncated yes     #AOF文件可能在尾部是不完整的 ( There was a problem with the last system shutdown, especially when the mount, Ext4 file system was not added with the data=ordered option, which only happens when the OS crashes, and Redis itself is not completely dead. There is a problem when the Redis restarts when the load is in memory. When it happens, you can choose Reids to start an error, or load as much normal data as possible. If aof-load-truncated is yes, a log is automatically published to the client and then load (default). If it is no, the user must manually reids-check-aof repair the aof file before it can. lua-time-limit 5000     #Lua脚本的最大执行时间, unit milliseconds, error after timeout, and counted into the log; When a script runs longer than the maximum execution time, only scripts  kill and  shutdown nosave Two commands can be used; The Script kill is used to stop a script that does not invoke a write command. shutdown  Nosave is the only way to turn off the server in cases where the script's write command is executing the user and does not want to wait for the script to end normally. The following option is set to 0 or negative to cancel the script execution time limit Slowlog-log-slower-than 10000#redis Slow query logging exceeds the set time query, and only records the time the command was executed, I/O operations are not logged, such as: and client interaction , send reply etc; Time Unit is subtle, 1000000 subtle  = 1  second; setting to negative will disable slow query logging, and setting to 0 will log all query commands slowlog-max-len 128      #日志长度没有限制, but it consumes memory. When the log length is exceeded, the oldest record is removed and the memory is reclaimed using the Slowlog reset command latency-monitor-threshold 0    # Use latency to print the time-consuming chart of a Redis instance when running a command, recording only actions that are greater than or equal to the values set below. 0, is to turn off surveillance. Can be opened dynamically, directly run config set latency-monitor-thresholdnotify-keyspace-events  ""       #可以通知pub/sub Client about the change of key space. # , for example, if you turn on the switch. A client performed a del operation on the "Foo" key on the DATABASE0. Two messages will be released via  pub/sub# publish [email protected]__:foo del# publish [email  protected]__:del foo#  Most people do not need this feature, and it also requires a certain amount of overhead, so the default is off.  hash-max-ziplist-entries 512hash-max-ziplist-value 64#  hash uses efficient memory data structures when there are a small number of entries. The maximum entry cannot exceed the set threshold value. #和哈希编码一样, a small list is also encoded in a special way to save memory. The "small amount" setting is as follows: LIST-MAX-ZIPLIST-ENTRIES&NThe bsp;512list-max-ziplist-value 64#  collection uses special encodings to save memory only in the following cases # --> collection consists of a string of 64-bit signed 10 integers #  The following options set the size of this special collection. set-max-intset-entries 512#  Special encoding saves memory when the length and elements of an ordered set are set to the following numbers zset-max-ziplist-entries  128zset-max-ziplist-value 64hll-sparse-max-bytes 3000    hyperloglog don't understand. Greater than 16000 is totally unacceptable! When the CPU is very good to live, give 10000 can. Default to 3000.activerehashing yes     #哈希刷新使用每100个CPU毫秒中的1毫秒来帮助刷新主哈希表 (top-level key-value mapping table); The Redis hash table uses a lazy refresh mechanism, with more operations and more refreshes. If the server is idle, the refresh operation will not occur and more memory will be flushed by the hash table 10 times per second, freeing up memory. If you have a hard-to-delay demand, the occasional 2-millisecond delay is intolerable. Set to No, otherwise set to yes# client output cache limit forced Disconnect read slower client # There are three types of restrictions #normal ->  normal clients include monitoring clients #slave ->  At least one channel has been subscribed to from client # pubsub ->  client or mode #  client output cache limit syntax is as follows (time unit: seconds) #  client-output-buffer-limit < category > < Mandatory restrictions > < soft limit > < soft time >#  To force limit the cache size, disconnect the link immediately. #  to soft limit, there will still be a soft time-size link time #  default normal client unrestricted, only after the request, the asynchronous client data request faster than it can read the data speed #  the subscription mode and the master-slave client and the default limit, because they accept push. #  both mandatory and soft limits can be setDisable this feature for Client-output-buffer-limit normal 0 0 0client-output-buffer-limit slave  256mb 64mb 60client-output-buffer-limit pubsub 32mb 8mb 60hz 10#   Set the frequency of Redis background task execution, such as clearing expired key tasks. The #  setting range is 1 to 500 and defaults to 10. The larger the CPU consumption, the smaller the delay. #  recommended not to exceed 100aof-rewrite-incremental-fsync yes#  when the child process overrides the AoF file, the following options are turned on, and the aof file is synchronized every time 32M data is generated. #  This helps to write files to disk faster to avoid delays


This article from the "Years in the passing, shining still in" blog, please be sure to keep this source http://taokey.blog.51cto.com/4633273/1770855

Redis configuration file redis.conf parameter details

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.