Detailed description of the Redis configuration file, for 2.6.3 -- 2.6.7, redis2.6.3 -- 2.6.7

Source: Internet
Author: User
Tags allkeys syslog strong password

Detailed description of the Redis configuration file, for 2.6.3 -- 2.6.7, redis2.6.3 -- 2.6.7

Detailed description of the Redis configuration file, for 2.6.3 -- 2.6.7

# Note on units: when memory size is needed, it is possible to specify
# It in the usual form of 1 k 5 GB 4 M and so forth:
#
#1 k = & gt; 1000 bytes
# 1kb => 1024 bytes
#1 m => 1000000 bytes
#1 mb => 1024*1024 bytes
#1g => 1000000000 bytes
#1 gb => 1024*1024*1024 bytes
#
# Units are case insensitive so 1 GB 1 Gb 1 gB are all the same.

# Redis is not run as a daemon by default. You can set this to "yes" to run as a daemon.
# Note: when used as a daemon, Redis writes the process ID to/var/run/redis. pid.
Daemonize yes

# When running as a daemon, Redis writes the process ID to/var/run/redis. pid by default. You can modify the path here.
Pidfile/var/run/redis. pid

# The port that accepts the connection. The default value is 6379.
# If the port is set to 0, Redis will not listen to TCP sockets
Port 6379

# If the port is set to 0, Redis will not listen to TCP sockets
Port 6379

# If you want to bind a single interface, if not set separately, all interfaces will be listened.
#
# Bind 127.0.0.1

# Specify the path for listening to the connected unxi socket. There is no default value for this, so if you do not specify it, Redis will not pass the unix socket
# Unixsocket/tmp/redis. sock
# Unixsocketperm 755

# How many seconds after a client is idle. (0 indicates disabled and never disabled)
Timeout 0

# Set the server debugging level.
# Debug (a lot of information, useful for development/Testing)
# Verbose (many simple and useful information, but not as many debug levels)
# Notice)

# Warning (only important/serious information is recorded)

Loglevel notice

# Specify the log file name. You can also use "stdout" to force Redis to write log information to the standard output.
# Note: If Redis runs as a daemon, and you set the log to display the standard output, the log will be sent to/dev/null.
Logfile stdout
# It is easy to use the system logger. You only need to set "syslog-enabled" to "yes.
# Set other syslog parameters as needed.
# Syslog-enabled no

# Specify syslog identity
# Syslog-ident redis

# Specify the syslog device. It must be a user or LOCAL0 ~ LOCAL7.
# Syslog-facility local0

# Set the number of databases. The default database is DB 0. You can use SELECT <dbid> WHERE dbid (0 ~ 'Databases'-1) to select a server for each link
Databases 16

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

# Save the database to the disk:
# Save <seconds> <changes>
#
# The database will be written to the disk after the specified number of seconds and the number of data changes.
#
# The following example writes data to the disk:
# After 900 seconds (15 minutes), and at least one change
# After 300 seconds (5 minutes), and at least 10 Changes
#60 seconds later, and at least 10000 changes
#
# Note: if you do not want to write a disk, just comment out all the "save" settings.

# Save 900 1
Save 300 30
# Save 60 10000

# Stop writing due to a storage error in the background.
Stop-writes-on-bgsave-error yes

# Whether to use LZF to compress string objects when exporting data to the. rdb database.
# The default value is "yes", so it almost always takes effect.
# If you want to save CPU, you can set this to "no", but if you have compress keys, the data file will be larger.
Rdbcompression yes

# Since verison 5 of RDB a CRC64 checksum is placed at the end of the file.
# This makes the format more resistant to upload uption but there is a performance
# Hit to pay (around 10%) when saving and loading RDB files, so you can disable it
# For maximum performances.
#
# Verify when storing and loading rdb files.
Rdbchecksum yes

# Database file name
Dbfilename dump. rdb

# Working directory
# The database will write to this directory, and the file name is the value of "dbfilename" above.
# Add files here.
# Note that you must specify a directory instead of a file name.
Dir ./

################################# Synchronization ###### ###########################
#
# Master-slave Synchronization. Use slaveof configuration to back up Redis instances.
# Note: Data is locally copied from the remote end. That is to say, local hosts can have different database files, bind different IP addresses, and listen on different ports.
#
# Slaveof <masterip> <masterport>

# If the master has set a password (configured using the "requirepass" option below), slave must perform authentication before starting synchronization, otherwise its synchronization request will be rejected.
#
# Masterauth <master-password>

# When an slave loses its connection to the master or the synchronization is in progress, there are two possible slave actions:
#
#1) If slave-serve-stale-data is set to "yes" (default), slave will continue to respond to client requests, which may be normal data, it may also be that empty data has not yet been obtained.
#2) If slave-serve-stale-data is set to "no", slave will reply "synchronizing with master in progress" to process various requests, besides the INFO and SLAVEOF commands.

Slave-serve-stale-data yes

# If yes, the slave instance is read-only. If no, the slave instance can be read and written.
Slave-read-only yes

# Slave sends a ping request to the server based on the specified interval.
# The time interval can be set through repl_ping_slave_period.
# The default value is 10 seconds.
#
# Repl-ping-slave-period 10

# The options below set the expiration time for large data I/O, Data Request to master, and ping response.
# The default value is 60 seconds.
#
# Make sure that the value is greater than repl-ping-slave-period. Otherwise, the transmission expiration time between the master and slave is shorter than expected.
# Repl-timeout 60

# If the master node cannot work normally, in multiple Server Load balancer instances, select one Server Load balancer instance with the smallest priority value as the master node. If the priority value is 0, the master node cannot be upgraded.
Slave-priority 100

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

# The client is required to verify the identity and password when processing any command.
# This is useful when you cannot trust visitors.
#
# For backward compatibility, comment out this section. And most people do not need authentication (for example, they run on their own servers .)
#
# Warning: Because Redis is too fast, people with bad intentions can try a K password every second to crack the password.
# This means you need a strong password. Otherwise, it will be too easy to crack.
#
# Requirepass foobared

# Command rename
#
# In a shared environment, you can change the name of a dangerous command. For example, you can change a name that is not easy to guess for CONFIG, so that you can still use it on your own, but others cannot do bad things.
#
# Example:
#
# Rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52
#
# You can even assign an empty string to the command to completely disable the command:
#
# Rename-command CONFIG ""

################################### Restrictions #### ################################

#
# Set the maximum number of connected clients at the same time.
# There is no limit by default. This is related to the number of file descriptors that can be opened by the Redis process.
# The special value "0" indicates no restriction.
# Once this limit is reached, Redis will close all new connections and send an error "reaching the maximum number of users (max number of clients reached )"
#
# Maxclients 128

# Do not use more memory than the configured upper limit. Once the memory usage reaches the upper limit, Redis will delete the key based on the selected recycle policy (see maxmemmory-policy.
#
# If Redis cannot delete the key due to deletion policy issues, or the policy is set to "noeviction", Redis will reply to the command with more memory errors.
# For example, SET and LPUSH. However, it will continue to respond to read-only commands properly, such as GET.
#
# This option is useful when Redis is used as the LRU cache or when the "noeviction" policy is set for the instance.
#
# Warning: when a bunch of slave instances are connected to the memory limit, the memory required to respond to the output cache required by slave is not counted in the memory usage.
# In this way, when a deleted key is requested, the network issue/re-synchronization event will not be triggered, and slave will receive a bunch of delete commands until the database is empty.
#
# In short, if you have a Server Load balancer instance connected to a master, we recommend that you set the master memory limit to a smaller value to ensure that enough system memory is used as the output cache.
# (It doesn't matter if the policy is set to "noeviction)
#
# Maxmemory <bytes>

# Incr decr rpush lpush rpushx lpushx linsert lset rpoplpush sadd

# Memory Policy: if the memory limit is reached, how does Redis Delete the key. You can choose from the following five policies:
#
# Volatile-lru-> delete an instance based on the expiration time generated by the LRU algorithm.
# Allkeys-lru-> delete any key based on the LRU algorithm.
# Volatile-random-> Delete keys randomly based on expiration settings.
# Allkeys-> random deletion without difference.
# Volatile-ttl-> Delete (supplemented by TTL) based on the latest expiration time)
# Noeviction-> no one will delete it, and an error will be returned directly during the write operation.
#
# Note: For all policies, if Redis cannot find a suitable key that can be deleted, an error will be returned during the write operation.
#
# The command involved here: set setnx setex append
# Incr decr rpush lpush rpushx lpushx linsert lset rpoplpush sadd
# Sinter sinterstore sunion sunionstore sdiff sdiffstore zadd zincrby
# Zunionstore zinterstore hset hsetnx hmset hincrby incrby decrby
# Getset mset msetnx exec sort
#
# The default value is as follows:
#
# Maxmemory-policy volatile-lru

# The implementation of LRU and the minimum TTL algorithm is not very accurate, but very close (to save memory), so you can use the example for testing.
# For example, by default, Redis checks the three keys and obtains the oldest one. You can set the number of samples through the following configuration items.
#
# Maxmemory-samples 3

############################# Pure accumulate mode ####### ########################
# By default, Redis asynchronously exports data to the disk. In this case, when Redis crashes, the latest data is lost.
# If you do not want to lose any piece of data, you should use the pure accumulate mode: once this mode is enabled, Redis will write the data written each time to the appendonly. aof file after receiving it.
# Redis reads the data in this file into the memory every time it starts.
#
# Note: database files exported asynchronously and pure accumulated files can coexist (you must comment out all the above "save" Settings and disable the export mechanism ).
# If the pure accumulate mode is enabled, Redis will load the log file at startup and ignore the exported dump. rdb file.
#
# Important: View BGREWRITEAOF to learn how to reprocess the log file in the background when the log file is too large.

Appendonly no

# Add file name (default: "appendonly. aof ")
# Appendfilename appendonly. aof

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.