Redis. conf configuration item description

Source: Internet
Author: User
Tags allkeys syslog password protection shared hosting
# Whether to run subsequent processes. The default value is "no". If you want to run a later process, change it to "yes ".

Daemonize No

# If a later process runs, you need to specify the PID where you can customize the location of the redis. PID file.

Pidfile/var/run/redis. PID

# Accept the port number of the connection. If the port is 0, redis will not listen to TCP socket connections.

Port 6379

# If you want you can bind a single interface, if the BIND option is not

# Specified all the interfaces will listen for incoming connections.

#

# Bind 127.0.0.1

# Specify the path for the UNIX socket that will be used to listen

# Incoming connections. There is no default, so redis will not listen

# On a UNIX socket when not specified.

#

# Unixsocket/tmp/redis. Sock

# Unixsocketperm 755

# Connection timeout, in seconds. (0 to disable )?

Timeout 300000000

# Log level. The default value is verbose (detailed). Various log levels:

# Debug: Detailed information, suitable for development and testing

# Verbose: contains a lot of less useful information, but it is more fresh than debug (Please rarely useful info, but not a mess like # the debug level)

# Notice: Suitable for Production Environments

# Warning: Warning Information

Loglevel verbose

# Specify the name of the log file. The default value is stdout. Stdout will allow redis to output logs to the standard output. However, if you use stdout and then run redis in the # process mode, the log will be output to/dev/null.

Logfile stdout

# If 'syslog-enabled 'is set to yes, logs are output to the system log. The default value is no.

# Syslog-enabled No

# Specify the syslog identifier. If 'syslog-enabled' is no, this option is invalid.

# Syslog-ident redis

# Specify the syslog device (facility), which must be user or local0 to local7.

# Syslog-facility local0

# Set the number of databases. The default database is db 0. You can select a database using select <dbid>. dbid is a number of [0, 'databases'-1 ].

Databases 16

################## Snapshot ##################### ############

#

# Save data on the hard disk:

#

# Save <seconds> <changes>

#

# When both <seconds> and <changes> are met, the data storage action is triggered.

#

#

# Example:

# After 900 seconds and one key changes, the SAVE action is triggered.

# After 300 seconds and 10 keys are changed, the SAVE action is triggered.

# After 60 seconds and at least 10000 keys are changed, the SAVE action is triggered.

#

# Note: if you do not want redis to automatically save data, comment out the following configuration!

Save 900 1

Save 300 10

Save 60 10000

# Whether to compress data when storing data. The default value is yes.

Rdbcompression Yes

# File name for saving dump data

Dbfilename dump. RDB

# Working directory.

#

# The data will be persisted to the file specified by 'dbfilename' in this directory.

#

#

# Note: The specified directory must not be a file.

Dir ./

######## Replication (replication, redundancy) #################################

# Master-slave replication. Use slaveof to set a redis instance as the slave database of another redis server (hot standby). Note: # The configuration is only valid for the current slave.

# Therefore, you can configure an slave to use different time intervals to save data or listen to other ports.

# Command format:

# Slaveof <masterip> <masterport>

# If the master has password protection, password verification is required before the slave and master data synchronization. Otherwise, the master will reject the slave request.

#

# Masterauth <master-Password>

# When slave loses its connection to the master, or slave still synchronizes data from the master (not consistent with the master), # slave can respond to client requests in two ways:

#

#1) If slave-serve-stale-data is set to 'yes' (the default), slave will still respond to client requests, which may cause problems.

#

#2) If slave-serve-stale data is set to 'no' slave, an error message such as "sync with Master in progress" will be returned. Except the info and slaveof commands.

#

Slave-serve-stale-data Yes

############### Security ######################## ###########

# The client needs to specify auth <password> before executing any command

#

# Requirepass foobared

# Command rename.

#

#

# Example:

#

# Rename-command config b840fc02d524045429941cc15f59e41cb7be6c52

#

# You can also rename a command as an empty string to kill the command completely. For example:

#

# Rename-command config ""

################### #################

# Set the maximum number of connections. There is no limit by default. '0' means no limit.

#

# Maxclients 128

# Maximum memory available. If it exceeds the limit, redis will try to delete the keys in the expire collection. Specifically, redis will try to release the expired # keys and protect the keys with a long life cycle.

#

# If this is not the case, redis will report an error, but query requests such as get will still receive a response.

#

# Warning: If you want to regard redis as a real dB, do not set <maxmemory>. Only you want to use redis as the cache or

# This parameter is required only when a stateful server ('state' server) is enabled.

#

# Maxmemory <bytes>

# Memory cleanup policy: If maxmemory is reached, you can take the following actions:

#

# Volatile-LRU-> use the LRU algorithm to delete expired Sets

# Allkeys-LRU-> delete any key following the LRU Algorithm

# Volatile-random-> randomly Delete keys in an expired set

# Allkeys-> random-> randomly delete a key

# Volatile-TTL-> Delete the recently expired key (the nearest expire time (minor TTL ))

# Noeviction-> it does not expire at all. An error is reported directly during write operations.

#

#

# Default policy:

#

# Maxmemory-policy volatile-LRU

# For redis memory processing, the LRU and minor TTL algorithms are not precise, but approximate (estimated) algorithms. So we will check some samples # For the purpose of memory check. The default number of samples is 3. You can modify it.

#

# Maxmemory-samples 3

################# Append only mode #################### ###########

# By default, redis asynchronously saves data to the hard disk. If your application scenario permits the loss of the latest data due to extreme situations such as system crashes #, this approach is okay. Otherwise, you should enable the 'append only' mode. After this mode is enabled, redis will be in the # appendonly. add each write operation to the aof file. This file will be read at redis startup to re-build the dataset in the memory.

#

# Note: If you need to enable the 'append only' mode and asynchronous dumps mode at the same time (You Need To comment out the 'save' expression above to disable # Stop dumps ), in this case, appendonly is preferred when redis reconstructs the data set. aof and ignore dump. RDB

#

Appendonly No

# Append only file name (default: "appendonly. aof ")

# Appendfilename appendonly. aof

# Call the fsync () function to notify the operating system to immediately write data to the hard disk

#

# Redis supports 3 medium mode:

#

# No: No fsync. It only notifies the OS that data can be flushed. Whether the data is flushed depends on the OS. The performance is better.

# Always: fsync is performed every time the append only log file is written. Poor performance, but safe.

# Everysec: There is no interval of 1 second for fsync. Compromise.

#

# The default value is "everysec"

# Appendfsync always

Appendfsync everysec

# Appendfsync No

# When the aof fsync policy is set to always or everysec and the saving process in the background is executing a large number of I/O operations

# Redis may block the fsync () call for a long time

#

No-appendfsync-on-Rewrite No

# Automatic rewriting of append only files

# When the aof log file is about to grow to a specified percentage, redis can automatically rewrite the append only file by calling bgrewriteaof.

#

# It does this: redis will remember the size of the aof file after the last rewrite. It then compares the size with the current size. If the current # size is larger than the specified percentage, the rewriting is triggered. Similarly, you need to specify the minimum size of the aof file to be overwritten, which avoids the fact that although the percentage has reached #, the file size is still small (in this case, there is no need to rewrite) however, it is useful to rewrite aof files.

#

#

# If auto-Aof-rewrite-percentage is set to 0, the aof rewrite function can be disabled.

Auto-Aof-rewrite-percentage 100

Auto-Aof-rewrite-Min-size 64 MB

################## Slow log #################### ###############

# Redis slow log is used to record queries that exceed the specified execution time.

#

# You can specify two parameters: one is the threshold value for slow query, in milliseconds, and the other is the length of slow log, which is equivalent to a queue.

# If it is negative, slow log is disabled. If it is 0, every command is recorded.

Slowlog-log-slower-than 10000

# If this parameter is not set, it will consume too much memory, so you should set it. You can use the slowlog reset command to reclaim the memory used by slow logs.

Slowlog-max-len 1024

################ Virtual memory ###################### #########

# Use redis instead of virtual memory. It is definitely not a good idea. Add a machine, so I will not translate it here !!

### Warning! Virtual Memory is deprecated inApsaradb hybriddb for redis 2.4

### The use of virtual memory isStronugly discouraged.

# Virtual memory allows redis to work with datasets bigger than the actual

# Amount of Ram needed to hold the whole dataset in memory.

# In order to do so very used keys are taken in memory while the other keys

# Are swapped into a swap file, similarly to what operating systems do

# With memory pages.

#

# To enable VM just set 'vm-enabled' to yes, and set the following three

# VM parameters accordingly to your needs.

VM-enabled No

# VM-enabled Yes

# This is the path of the redis swap file. as you can guess, swap files

# Can't be shared by different redis instances, so make sure to use a swap

# File for every redis process you are running. redis will complain if

# Swap file is already in use.

#

# The best kind of storage for the redis swap file (that's accessed at random)

# Is a solid state disk (SSD ).

#

# *** Warning *** if you are using a shared hosting the default of putting

# The swap file under/tmp is not secure. Create a dir with access granted

# Only to redis user and configure redis to create the swap file there.

VM-Swap-file/tmp/redis. Swap

# VM-max-memory configures the VM to use at Max the specified amount

# Ram. Everything that deos not fit will be swapped on disk * If * possible, that

# Is, if there is still enough contiguous space in the swap file.

#

# With VM-max-memory 0 the system will swap everything it can. Not a good

# Default, just specify the max amount of ram you can in bytes, But it's

# Better to leave some margin. For instance specify an amount of RAM

# That's more or less between 60 and 80% of your free RAM.

VM-max-memory 0

# Redis swap files is split into pages. An object can be saved using multiple

# Contiguous pages, but pages can't be shared between different objects.

# So if your page is too big, small objects swapped out on disk will waste

# A Lot Of space. If you page is too small, there is less space in the SWAp

# File (assuming you configured the same number of total swap file pages ).

#

# If you use a lot of small objects, use a page size of 64 or 32 bytes.

# If you use a lot of big objects, use a bigger page size.

# If unsure, use the default :)

VM-page-size 32

# Number of total memory pages in the swap file.

# Given that the page table (a bitmap of free/used pages) is taken in memory,

# Every 8 pages on disk will consume 1 byte of RAM.

#

# The total swap size is VM-page-size * VM-pages

#

# With the default of 32-bytes memory pages and 134217728 pages redis will

# Use A 4 GB swap file, that will use 16 MB of RAM for the page table.

#

# It's better to use the smallest acceptable value for your application,

# But the default is large in order to work in most conditions.

VM-pages 134217728

# Max number of vm I/O threads running at the same time.

# This threads are used to read/write data from/to swap file, since they

# Also encode and decode objects from disk to memory or the reverse, a bigger

# Number of threads can help with big objects even if they can't help

# I/O itself as the physical device may not be able to couple with role

# Reads/writes operations at the same time.

#

# The special value of 0 turn off threaded I/O and enables the blocking

# Virtual memory implementation.

VM-max-threads 4

################ Advanced Configuration ###################### #########

# Hashes are encoded in a special way (much more memory efficient) when they

# Have at Max a given numer of elements, and the biggest element does not

# Exceed a given threshold. you can configure this limits with the following

# Configuration ctictives.

Hhash-max-zipmap-entries 512

Hash-max-zipmap-value 64

# Similarly to hashes, small lists are also encoded in a special way in order

# To save a lot of space. The special representation is only used when

# You are under the following limits:

List-max-ziplist-entries 512

List-max-ziplist-value 64

# Sets have a special encoding in just one case: When a set is composed

# Of just strings that happens to be integers in Radix 10 in the range

# Of 64 bit signed integers.

# The following Configuration Setting sets the limit in the size of

# Set in order to use this special memory saving encoding.

Set-max-intset-entries 512

# Similarly to hashes and lists, sorted sets are also specially encoded in

# Order to save a lot of space. This encoding is only used when the length and

# Elements of a sorted set are below the following limits:

Zset-max-ziplist-entries 128

Zset-max-ziplist-value 64

# Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in

# Order to help rehashing the main redis hash table (the one mapping top-level

# Keys to values). The Hash Table Implementation redis uses (see dict. c)

# Performs a lazy rehashing: the more operation you run into an hash table

# That is rhashing, the more rehashing "Steps" are saved med, so if

# Server is idle the rehashing is never complete and some more memory is used

# By the hash table.

#

# The default is to use this millisecond 10 times every second in order

# Active rehashing the main dictionaries, freeing memory when possible.

#

# If unsure:

# Use "activerehashing no" if you have hard latency requirements and it is

# Not a good thing in your environment that redis can reply form time to time

# To queries with 2 milliseconds delay.

#

# Use "activerehashing yes" if you don't have such hard requirements

# Want To free memory ASAP when possible.

Activerehashing Yes

################## Des ##################### ##############

# Include one or more other config files here. This is useful if you

# Have a standard template that goes to all redis server but also need

# To customize a few per-server settings. Include files can include

# Other files, so use this wisely.

#

# Include/path/to/local. conf

# Include/path/to/other. conf

Redis. conf configuration item description

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.