Description of redis.conf configuration items

1. daemonize no

Redis does not run as a daemon process by default, you can modify it through this configuration item and use yes to enable the daemon process

 

2. pidfile /var/run/redis_6379.pid

When Redis runs as a daemon process, even if this item is not configured, Redis will write the pid to the /var/run/redis.pid file by default; and when Redis is not running as a daemon process, if this item is not configured, then redis will not create the pid file. Creating a pid file is a tentative action. Even if the creation and writing fails, redis can still start and run.

 

3.port 6379

Specify the Redis listening port, the default port is 6379. The author explained in his blog post why 6379 was chosen as the default port, because 6379 is the number corresponding to MERZ on the phone button, and MERZ is taken from the name of Italian singer Alessia Merz

 

4.bind 127.0.0.1

bind host address

 

5.timeout 300

When the client is idle for how long to close the connection, if it is specified as 0, it means to close the function

 

6.loglevel verbose

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

 

7.logfile ""

Logging mode, configure an empty string to force the log to print to standard output. If Redis is configured to run in daemon mode, and the logging mode is configured as standard output, the log will be sent to /dev/null

 

8.databases 16

 Set the number of databases, the default database is 0, you can use the SELECT <dbid> command to specify the database id on the connection

 

9  save <seconds> <changes>

Specify how many update operations in a period of time, and synchronize the data to the data file, which can be matched with multiple conditions

    Three conditions are provided in the Redis default configuration file:

    save 900 1

    save 300 10

    save 60 10000

    Respectively means 1 change in 900 seconds (15 minutes), 10 changes in 300 seconds (5 minutes), and 10000 changes in 60 seconds.

 

10. stop-writes-on-bgsave-error yes 

If there is an error when persisting data in the way of RDB, redis will not receive write operations by default, so that the application layer can perceive that there is a problem, configure it to no to disable;

 

11.rdbcompression yes

Specifies whether to compress data when storing to the local database. The default is yes. Redis uses LZF compression. If you want to save CPU time, you can turn off this option, but it will cause the database file to become huge.

 

 

12.dbfilename dump.rdb

 Specify the local database file name, the default value is dump.rdb

 

13. you ./

Specify the local database storage directory

 

14. slaveof <masterip> <masterport>

When the machine is the slave service, set the IP address and port of the master service. When Redis starts, it will automatically synchronize data from the master

 

15.slave-serve-stable-data yes

 When a slave loses its connection to its master, this configuration is used to specify whether the slave will continue to receive client requests. If yes, it will continue to receive. If no, the slave will reply to the "SYNC with master in progress" error to all client requests. requests (except info and slaveof commands)

 

16.slave-read-only yes

Whether the slave is read-only, the default is yes

 

17 repl-diskless-sync no

Master and slave synchronization strategy: disk or socket

When the slave synchronizes with the master, the master will generate the rdb file and transfer it to the slave. This transfer process has two forms:

1. Disk-backed: The master fork sends a child process to write the rdb file to disk first, and then the master process sends the rdb to the slaves

2. Diskless: The master forks a child process to directly send the rdb file to the slaves. During this process, the master cannot provide synchronization to other slaves, and the synchronization of the subsequent slaves must be queued. But you can specify how long the master waits before fork, so as to send the rdb file to multiple slaves at the same time as much as possible

 

18.repl-diskless-sync-delay 5

The specified delay, in seconds

 

 19.repl-ping-slave-period 10 

The slave sends the heartbeat interval, in seconds

   

 20.repl-timeout 60

The configuration specifies:

1. The IO timeout on the slave side during synchronization

2. Master timeout (from the slave's point of view, data, ping)

3.slave timeout (from the master's point of view)

unit second

For example, repl-ping-slave-period is configured to 10 and this item is configured to 60, if the slave sends 6 consecutive pings and does not receive a pong from the master, the slave will subjectively think that the master is dead

    

21.repl-disable-tcp-nodelay no

 

22.repl-backlog-size 1mb

slave synchronization buffer size

 

23.repl-backlog-ttl 3600

Slave synchronization buffer survival time (when the master disconnects from the corresponding slave)

 

24.slave-priority 100

The election priority of the slave, the smaller the priority, but if set to 0, there is no right to be elected, and the default is 100

 

25. masterauth <master-password>

 When the master is password-protected, the slave's password to connect to the master

 

26 requirepass foobared

 Set the Redis connection password. If the connection password is configured, the client needs to provide the password through masterauth when connecting to Redis. It is disabled by default.

 

27 maxclients 128

Set the maximum number of client connections at the same time. The default is unlimited. The number of client connections that Redis can open at the same time is the maximum number of file descriptors that the Redis process can open. If maxclients is set to 0, it means that there is no limit. When the number of client connections reaches the limit, Redis will close the new connection and return the max number of clients reached error message to the client

 

28 maxmemory <bytes>

Specify the maximum memory limit of Redis. Redis will load data into memory when it starts up. After reaching the maximum memory, Redis will first try to clear the keys that have expired or are about to expire. After this method is processed, the maximum memory setting is still reached. Write operations will no longer be possible, but read operations will still be possible. The new vm mechanism of Redis will store the Key in the memory and the Value in the swap area. If it is set to 0, the memory will not be limited. The 64-bit system does not limit the memory by default, and the 32-bit system defaults to a maximum of 3GB.

 

maxmemory-policy (noeviction | allkeys-lru | volatile-lru | allkeys-random | volatile-random | volatile-ttl)

When the memory reaches the threshold, redis's processing strategy for commands that will increase memory:

noeviction: return error

allkeys-lru: Use the lru algorithm to delete some keys for all keys

volatile-lru: For all keys with timeouts, use the lru algorithm to delete some keys

allkeys-random: Use a random algorithm to delete some keys for all keys

volatile-random: For all keys with a timeout, use a random algorithm to delete some keys

volatile-ttl: For all keys with timeout, use random algorithm to delete some keys, and delete those with short survival time first

 

29.appendonly no

Specifies whether to perform logging after each update operation. Redis writes data to disk asynchronously by default. If it is not turned on, it may cause data loss for a period of time during power failure. Because redis itself synchronizes data files according to the above save conditions, some data will only exist in memory for a period of time. Default is no

 

30.appendfilename appendonly.aof

Specify the update log file name, the default is appendonly.aof

 

31. appendfsync everysec

Specify the update log condition, there are 3 optional values: 
    no: means to wait for the operating system to synchronize the data cache to the disk (fast) 
    always: means to manually call fsync() after each update operation to write the data to the disk (slow, safe) 
    everysec: means sync once per second (compromise, default)

 

32.vm-enabled no

 Specifies whether to enable the virtual memory mechanism. The default value is no. To briefly introduce, the VM mechanism stores data in pages, and Redis swaps the pages with less access, that is, cold data, to the disk, and the pages that are accessed more are automatically swapped out by the disk. into memory (in a later article I will carefully analyze the VM mechanism of Redis)

 

33 vm-swap-file /tmp/redis.swap

The virtual memory file path, the default value is /tmp/redis.swap, which cannot be shared by multiple Redis instances

 

34 vm-max-memory 0

Store all data larger than vm-max-memory in virtual memory, no matter how small vm-max-memory is set, all index data are stored in memory (Redis index data is keys), that is, when vm-max When -memory is set to 0, all values ​​actually exist on disk. Default value is 0

 

35.vm-page-size 32

The Redis swap file is divided into many pages. An object can be stored on multiple pages, but a page cannot be shared by multiple objects. The vm-page-size should be set according to the size of the stored data. The author recommends that if To store many small objects, the page size is best set to 32 or 64 bytes; if you store very large objects, you can use a larger page, if you are not sure, use the default value

 

36. vm-pages 134217728

Set the number of pages in the swap file. Since the page table (a kind of bitmap indicating page free or used) is placed in memory, every 8 pages on disk will consume 1byte of memory.

 

37 vm-max-threads 4

Set the number of threads accessing the swap file, preferably not more than the number of cores of the machine. If it is set to 0, then all operations on the swap file are serial, which may cause a long delay. Default is 4

 

38 glueoutputbuf yes

Set whether to combine smaller packets into one packet to send when replying to the client, the default is ON

 

39 

    hash-max-zipmap-entries 64

    hash-max-zipmap-value 512

Specifies to use a special hash algorithm when a certain number or the largest element exceeds a certain threshold

 

40. activerehashing yes

Specifies whether to activate the reset hash, the default is on

 

41 include /path/to/local.conf

Specify to include other configuration files, you can use the same configuration file between multiple Redis instances on the same host, while each instance has its own specific configuration file

 

42 slowlog-log-slower-than 10000

The unit is microsecond, and the specified slow command will be recorded in the slow log. This time is the pure execution time of the command, that is, the time excluding IO, etc. If it is < 0, the slow log will not be recorded. Order

 

42 slowlog-max-len 1024

 Maximum number of slow log records

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326334704&siteId=291194637