Description of parameters in the redis configuration file

Source: Internet
Author: User
Tags allkeys integer numbers

Description of parameters in the redis configuration file
Blog posts are original except for reposted. Indicate the source for reprinting.
Link: http://blog.chinaunix.net/uid-31396856-id-5757212.html


= Basic settings =
Databases 16
Database quantity

Maxclients 10000
Max connections

Tcp-Back log 511
Length of the listen queue

Maxmemory-policy allkeys-lru
Memory Policy setting parameters: if the memory limit is reached, how does Redis Delete keys? redis has the following five policies:
Volatile-lru-> Delete Objects Based on the expiration time generated by the LRU algorithm.
Allkeys-lru-> delete any key based on the LRU algorithm.
Volatile-random-> deletes keys randomly based on the expiration settings.
Allkeys-> random deletion without any 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.

Maxmemory-samples 5
The implementation of LRU and the minimum TTL algorithm is not very accurate, but very close (to save memory), you can use the example for testing.

Daemonize yes
Start in daemon mode: Run in daemon mode

Timeout 0
The timeout time for client connection, in seconds. The connection is closed after the timeout, and 0 Never times out;

Tcp-keepalive 0
Interval between failed client connections. Unit: seconds. Setting it to 0 indicates that detection is prohibited;

Loglevel notice
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 (the right amount of information is basically what you need in the production environment)
Warning (only important/serious information is recorded
Log record level. Four optional values: debug (debugging)> verbose (simplified)> notice (moderate)> warning (warning)

=== Rdb snapshot related ===
Stop-writes-on-bgsave-error yes
Whether to stop writing when the snapshot fails during serialization. If there is a monitoring mechanism, consider "no ".

Rdbcompression yes
Compression during snapshot creation in rdb

Dbfile dump. rdb
Snapshot file name settings

Rdbchecksum yes
Whether to enable the CRC64 check during generation and loading, which consumes about 10% of the performance after enabling, but is more secure.

=== Copy related parameters ====
Slaveof
Masterauth passwd // Authorization password

Slave-serve-stale-data yes
If a Server Load balancer instance loses its connection to the master node or the synchronization is in progress, do you want to continue responding to the client:
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 from master (6 SYNC with master in progress)" to process various requests, besides the INFO and SLAVEOF commands.

Slave-read-only yes
The parameter is configuration: Read-only from the slave Database

Repl-disable-tcp-nodelay no
A parameter is used to merge tcp data packets to save bandwidth, but will produce a latency of about 40 ms. no is to send data immediately without delay.

Repl-ping-slave-period 10
Slave sends ping requests to the server based on the specified interval. The default value is 10 s.

Repl-timeout 60
The expiration time of the data request and ping response to the master node. The default value is 60 s. It must be larger than repl-ping-slave-period;

Repl-backlog-size 32 mb
The size of the data stored by the master for the slave. If the size of the data exceeds this size, full replication will also occur.

Repl-backlog-ttl 3600
After the master and slave are disconnected, how long will the master save the data for the slave? the buffer will be released after this period of time

Slave-priority 80
After the master database fails, the slave database is upgraded to the master database priority.

= Aof parameter ====
Appendonly no
Whether to enable aof Mode

# Appendfilename "8888.aof"
File name after aof mode is enabled

# Appendfsync everysec
Fsync () requests the operating system to write data to the disk: whether to write data per second
No: do not click it immediately. You can click it again only when the operating system needs to click it. Fast.
Always: Every write operation is immediately written to the aof file. Slow, but safest.
Everysec: Write once per second. Compromise.

# No-appendfsync-on-rewrite yes
When writing aof, discard the changes of the master process, and may lose the log. The response will not be delayed when the master process is not in high concurrency.
If there is a latency problem, set it to "yes"; otherwise, keep "no", which is the safest way to save persistent data.

# Auto-aof-rewrite-percentage 80
This log is overwritten when the aof file size percentage is increased;

# Auto-aof-rewrite-min-size 50000 mb
When the size of the aof file increases to a large value, rewrite the log;

# Aof-rewrite-incremental-fsync yes
Set to yes. When you modify the aof file, you only need to generate 32 MB data for synchronization;

= Slow log ===
Slowlog-log-slower-than 10000
Records operations over 1 s
Slowlog-max-len 128
Record 128 operations

=== Virtual memory
Vm-enabled no
Whether to enable virtual memory. Generally, it is not enabled.

Hash-max-ziplist-entries 512
Configure the maximum number of element entries. When the number of entries exceeds the configured number, redis uses a special hash algorithm.
Hash-max-ziplist-value 64
Specifies the maximum element value. If this value is exceeded, a special hash algorithm is used.
When there is a large amount of data, it is suitable to use Hash encoding (requires more memory), the maximum number of elements cannot exceed the given limit.

List-max-ziplist-entries 512
List-max-ziplist-value 64
If there are few data elements, another method can be used for encoding to save space.

Set-max-intset-entries 512
The data is a string consisting of 64-bit unsigned integer numbers. Maximum encoding limit
Zset-max-ziplist-entries 128
Zset-max-ziplist-value 64
Ordered sequences can also be processed in a special encoding method, which saves space. This encoding is suitable for length and element.

Activerehashing yes
Hash refresh. If you do not care much about the latency and want to release the memory as soon as possible, enable it. The latency and memory (capacity) will directly balance the performance.

Client-output-buffer-limit normal 0 0 0
Limiting the client output buffer can force clients that do not read data from the server to disconnect.
For normalclient, the first 0 indicates canceling the hardlimit, the second 0 indicates canceling the soft limit, and the normalclient cancels the limit by default,
The client does not receive data if no query is performed.

Client-output-buffer-limit slave 768 mb 256 mb 60
For slaveclient and MONITER client, if the client-output-buffer exceeds 768 mb or exceeds mb for 60 seconds, the server will immediately disconnect the client.

Client-output-buffer-limit pubsub 32 mb 8 mb 60
For pubsub client, if the client-output-buffer exceeds 32 mb or exceeds 8 mb for 60 seconds, the server will immediately disconnect the client.

Hz 10
Redis internal scheduling frequency

Latency-monitor-threshold 0
Use LATENCY to print the time consumption chart of the redis instance when running commands. The monitoring frequency is 0, which is not monitored.

Lua-time-limit 5000
Limit the maximum running time of the script. The default value is 5 seconds.

===== Security ===
# Masterauth "password"
# Requirepass "password"
# Generated by CONFIG REWRITE
-- The end

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.