Redis configuration file in a detailed

Source: Internet
Author: User
Tags allkeys

= = Basic Configuration

Daemonize no whether the next stage process starts

Databases 16 The number of database created (the database 0 is selected by default)

Save 1 #刷新快照到硬盘中, must meet both requirements to trigger, that is, 900 seconds after at least 1 keywords changed.

Save #必须是300秒之后至少10个关键字发生变化.

Save 10000 #必须是60秒之后至少10000个关键字发生变化.

Stop-writes-on-bgsave-error Yes #后台存储错误停止写.

Rdbcompression Yes #使用LZF压缩rdb文件.

Rdbchecksum Yes #存储和加载rdb文件时校验.

Dbfilename Dump.rdb #设置rdb文件名.
Dir./#设置工作目录, the Rdb file is written to the directory.

= = Master Configuration

Slaveof <masterip> <masterport> Set as slave server for a machine

Masterauth <master-password> Connect the password of the master server

Slave-serve-stale-data Yes # answer from server when master or slave is disconnected or replicating

Slave-read-only Yes #从服务器只读

Repl-ping-slave-period #从ping主的时间间隔, Seconds

Repl-timeout #主从超时时间 (timed out), bigger than period

Slave-priority #如果master不能再正常工作, then in multiple slave, select a slave with the lowest priority value to master, and a priority value of 0 indicates that it cannot be promoted to master.


Repl-disable-tcp-nodelay no #主端是否合并数据, hunk sent to
Slave
Slave-priority 100 priority from the server, when the main service is hung, will automatically pick slave the minimum of the main service


= = Safe

Requirepass foobared # requires a password

Rename-command config b840fc02d524045429941cc15f59e41cb7be6c52 #如果公共环境, you can rename some sensitive commands such as CONFIG

= = = Limit

MaxClients 10000 #最大连接数

MaxMemory <bytes> #最大使用内存


Maxmemory-policy Volatile-lru #内存到极限后的处理

VOLATILE-LRU, LRU algorithm Delete expired
Key
ALLKEYS-LRU---LRU algorithm Delete key (does not distinguish between expired)

Volatile-random, random Delete expiration
Key
Allkeys-random---Random Delete key (does not distinguish between not expired)

Volatile-ttl, delete fast expired key

Noeviction-Not Delete, return error message

#解释 LRU TTL is an approximate algorithm, you can choose N, and then compare the most suitable for t kicked out of the data
Maxmemory-samples 3

= = Log Mode

AppendOnly No #是否仅要日志

Appendfsync No # system buffering, unified write, fast speed

Appendfsync always # system does not buffer, direct write, slow, loss of data less

Appendfsync everysec #折衷, write 1 times per second


No-appendfsync-on-rewrite no #为yes, the data in other threads is put into memory, combined write (faster, more easily lost)

Auto-aof-rewrite-percentage 100 The current AOF file is overridden when the last rewrite is large n%

Auto-aof-rewrite-min-size 64mb AOF Rewrite at least the size to reach

= = Slow Query

Slowlog-log-slower-than 10000 #记录响应时间大于10000微秒的慢查询

Slowlog-max-len 128 # up to 128 records


= = = Server command
Time return timestamp + microseconds
Dbsize returns the number of keys
Bgrewriteaof rewrite aof
Bgsave Background Open sub-process dump data
Save block Process Dump data

Lastsave

Slaveof host Port does the slave server of host port (data is emptied, the new master content is copied)
Slaveof no one becomes the primary server (the original data is not lost, generally used for failure of the main service)

FLUSHDB clears all data from the current database
Flushall Erase all data from all databases (what if I misuse it?)


shutdown [Save/nosave] shutdown server, save data, modify AOF (if set)


Slowlog get get slow query log

Slowlog Len gets the number of slow query log bars

Slowlog Reset Empty Slow query

info []

Config get option (support * wildcard)

Config SET option value
Config rewrite write the value to the configuration file
Config
Restart update information for info command

Debug Object key #调试选项, see the case of a key
Debug Segfault
#模拟段错误, let the server crash
Object Key (Refcount|encoding|idletime)

Monitor #打开控制台, watch commands (Debug)

Client List #列出所有连接

Client Kill #杀死某个连接
CLIENT KILL 127.0.0.1:43501
Client GetName #获取连接的名称 Default
Nil
Client SetName "name" #设置连接名称 for easy commissioning


= = = Connection Command = = =

Auth Password #密码登陆 (if you have a password)

Ping #测试服务器是否可用

echo "Some content" #测试服务器是否正常交互

Select 0/1/2 ... #选择数据库

Quit #退出连接

Redis configuration file in a detailed

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.