Redis study notes (a) configuration file Parameter Description

1, Redis is not the default way daemon is running, you can modify the configuration item, use yes Enable daemon

daemonize no

2, when redis when running in daemon mode, Redis default will write /var/run/redis.pid pid file can be specified by pidfile

pidfile /var/run/redis.pid

3, Redis designated monitor port, the default port 6379

port 6379

4, binding of host addresses, if required to access outside the local host, should be set to 0.0.0.1

bind 127.0.0.1

5, when the client closes the connection is idle for a long time, if specified as zero disables this function

timeout 300

6, specify the logging level, Redis supports a total of four levels: debug, verbose, notice, warning, the default is verbose

loglevel verbose

7, logging mode, the default is standard output, if configured to run as a daemon Redis, and here and configure logging to standard output, the log will be sent to, dev / null

logfile stdout

8, set the number of databases, 0 is the default database, you can use the SELECT Id command specifies the database on the connection

database 16

9, specifies how long, how many times the refresh operation, the data will be synchronized to the data file, a plurality of conditions can be fitted

save

Redis default configuration file is available in three conditions:

save 900 1

save 300 10

save 60 10000

Were 900 seconds (15 minutes) a change, 300 seconds (5 minutes) 10 10 000 Change Change and 60 seconds

10, when specifying whether to compress data stored in the local database, the default yes, Redis using LZF compression, if the CPU in order to save time, you can turn this option off, but will cause the database files become huge

rdbcompression yes

11, specify the local database file name, the default is dump.rdb

dbfilename drump.rdb

12, specify the local database storage directory

to you ./

13, when the unit is set when the slave service, the service master set of IP address and port, at Redis starts, it will automatically be synchronized from the master data

salveof

14, when the master service is password-protected, slav service connection master password

masterauth

15, provided redis connection password, if the password is configured connector, when connected to the client need AUTH Redis Command provides password, off by default

requirepass foobared

16, set at the same time the maximum number of client connections, default unlimited number description maximum file number of client connections Redis can be opened at the same time as Redis process can be opened, if set maxclient 0, an unlimited amount, when the client connections reaches time limit, Redis will close the new connection to the client returns the max number of clients reached an error message

maxclients 128

17, Redis specify the maximum memory limit, Redis data will be loaded at startup into memory, after reaching the maximum memory, Redis will first try to clear expired or about to expire key, when this method worked, still achieve the maximum memory settings will no longer be able to write to, but you can still read operation, Redis new VM mechanism will key storage memory, value will be stored in the swap area

maxmemory

18, specify whether after each update operation logging, Redis default asynchronous data is written to disk, if you do not turn, may result in data over a period of time when power is lost. Because the Redis data file synchronization itself is in accordance with the conditions to save synchronized, so some data will exist only in the memory for some time. No default

appendonly no

19, the update log file name specified, the default is appendonly.aof

appendfilename appendonly.aof

20, the update log specified conditions, there are three optional values

no: represents operating systems such as synchronizing data cache to disk

always: each represents a manual update operation after calling fsync () writes data to disk (slow, safe)

everysec: represents the sync once per second

21, specify whether to enable virtual memory mechanism, the default value is No, vm store the data paging mechanism by Redis will be less traffic to the page that is cold swap data to disk, access to multiple pages automatically swapped out to disk by the memory

vm-enabled no

22, the virtual memory file path, the default value /tmp/redis.swap, not a plurality of instances sharing Redis

vm-swap-file /tmp/redis.swap

23, all the data is greater than vm-max-memory stored in virtual memory, regardless vm-max-memory settings how small, all index data is stored in memory, that is, when vm-max-memory is set to 0 when, in fact all value are present in the disk, the default value 0

vm-max-memory 0

24, Redis swap file into a number of page, a page object can be stored in a plurality of the above, but a plurality of page objects that can not be shared, vm-page-size according to the size of the stored data set, if store many small objects, page size is preferably set to 32 or 64bytes; if the store a lot of large objects, you can use a larger Page, if uncertain, the default value

vm-page-size 32

25, set the number of page swap file, because the page table (one representation page or use the free bitmap) is placed in memory, on disk each of the eight pages of memory will consume 1byte

vm-pages 134217728

26, set the number of threads to access the swap file, it is best not to exceed the number of core machine, if set to 0, then all operations on the swap file is serial, it may cause relatively long delays, default is 4

vm-max-threads 4

27, set in the response to the client, whether to include smaller and sends a packet, is enabled by default

glueoutputbuf yes

28, when more than a certain specified amount or the maximum element exceeds a critical value, using a special hash algorithm

hash-max-zipmap-entries 64

hash-max-zipmap-value 512

29, specify whether to activate the reset hash, is enabled by default

activerehashing yes

30, designated include other configuration files, the same host can then use the same configuration files between multiple Redis instances, while each instance has its own specific profile

include /path/to/local.conf

Guess you like

Origin www.cnblogs.com/wenha/p/12292625.html