redis-configuration file Detailed

Source: Internet
Author: User
Tags allkeys

1. Basic configuration
Daemonize no whether to start with a background process
Databases 16 The number of databases created (database 0 is selected by default)
Save 900 1 # Refresh snapshot to hard disk, must meet the requirements of both to trigger, that is, at least 1 keyword changes after 900 seconds.
Save 300 10 # Must be at least 10 keywords after 300 seconds.
Save 60 10000 # Must be at least 10,000 keywords changed after 60 seconds.
Stop-writes-on-bgsave-error yes #Background storage error stops writing.
Rdbcompression yes #Use LZF to compress rdb files.
Rdbchecksum yes #Verify when storing and loading rdb files.
Dbfilename dump.rdb #Set the rdb file name.
Dir ./ #Set the working directory, the rdb file will be written to this directory.

2. Master-slave configuration
Slaveof <masterip> <masterport> Set as a slave to a machine
Masterauth <master-password> password to connect to the primary server
Slave-serve-stale-data yes # When the master is disconnected or is replicating, does the slave respond?
Slave-read-only yes #read-only from the server
Repl-ping-slave-period 10 #from ping master time interval, seconds
Repl-timeout 60 #Master-slave timeout (timeout is considered to be broken), larger than period
Slave-priority 100 #If the master can no longer work normally, then in a plurality of slaves, select one of the slaves with the lowest priority value and promote it to the master. The priority value of 0 means that it cannot be promoted to the master.

Repl-disable-tcp-nodelay no # Whether the main end merges data, and the chunk is sent to the slave
Slave-priority 100 from the priority of the server, when the main service is hung, it will automatically pick the slave service with the smallest slave priority.

3. Security
Requirepass foobared # requires a password
Rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52 #If the public environment, you can rename some sensitive commands such as config

5. Limitation
Maxclients 10000 #Maximum number of connections
Maxmemory <bytes> #maximum memory usage

Maxmemory-policy volatile-lru #Memory to the limit after processing
Volatile-lru -> LRU algorithm delete expired key
Allkeys-lru -> LRU algorithm deletes the key (does not distinguish between expired)
Volatile-random -> randomly remove expired keys
Allkeys-random -> randomly delete the key (do not distinguish it from expired)
Volatile-ttl -> delete fast expired keys
Noeviction -> Do not delete, return error message

#解 LRU ttl is an approximation algorithm, you can choose N, and then compare the data that is most suitable for T kicking.
Maxmemory-samples 3

6. Log mode
Appendonly no #whether only log
Appendfsync no # system buffer, unified write, fast
Appendfsync always # The system does not buffer, write directly, slow, lose less data
Appendfsync everysec #offset, write once per second

No-appendfsync-on-rewrite no #为yes, the data of other threads is put in memory, merged and written (fast, easy to lose)
auto-AOF-rewrite-percentage 100 The current aof file is rewritten when the last rewrite was a large N%
auto-AOF-rewrite-min-size 64mb aof rewrite at least the size to be reached

7. Slow query
Slowlog-log-slower-than 10000 # Record slow response with response time greater than 10000 microseconds
Slowlog-max-len 128 # record up to 128

8. Server command
Time returns timestamp + microseconds
Dbsize returns the number of keys
Bgrewriteaof rewrite aof
Bgsave background to open child process dump data
Save block process dump data
Lastsave

Slaveof host port The slave server that does the host port (data is cleared, the new main content is copied)
Slaveof no one becomes the primary server (the original data is not lost, generally used after the main service fails)

Flushdb clears all data from the current database
Flushall clears all data for all databases (what should I do if I misuse it?)

Shutdown [save/nosave] Shut down the server, save the data, modify the AOF (if set)

Slowlog get Get slow query log
Slowlog len Get the number of slow query logs
Slowlog reset clear slow query

Info []

Config get option (support * wildcard)
Config set option value
Config rewrite writes the value to the configuration file
Config restart Update information about the info command

Debug object key #Debug option, see a key situation
Debug segfault # simulate segmentation error, let the server crash
Object key (refcount|encoding|idletime)
Monitor #Open the console and observe the command (for debugging)
Client list #list all connections
Client kill #kill a connection CLIENT KILL 127.0.0.1:43501
Client getname #Get the name of the connection Default nil
Client setname "name" #Set the connection name for easy debugging

9. Connection command ===
Auth password #password login (if password is available)
Ping #test server is available
Echo "some content" #Test whether the server is interacting properly
Select 0/1/2... #Select database
Quit #退接


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.