Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the parameters of Redis

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly talks about "what are the parameters of Redis". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "what are the parameters of Redis"?

1 daemonize no

Redis does not run as a daemon by default. You can use this configuration item to enable the daemon using yes (no is not supported by Windows).

2 pidfile / var/run/redis.pid

When Redis runs as a daemon, Redis writes pid to the / var/run/redis.pid file by default, which can be specified through pidfile

3 timeout 300

When the client is idle for how long, the connection is closed. If specified as 0, the function is disabled.

4 loglevel notice

When the client is idle for how long, the connection is closed. If specified as 0, the function is disabled.

5 databases 16

Set the number of databases. The default database is 0. There are 16 databases in total. You can use the SELECT command to specify the database id on the connection.

6 save

Specify how long and how many update operations will synchronize the data to the data file, which can be matched by multiple conditions.

Three conditions are provided in the Redis default configuration file:

Save 9001 means 1 change in 900 seconds (15 minutes)

Save 30010 means 10 changes in 300 seconds (5 minutes)

Save 60 10000 means 10000 changes in 60 seconds

7 rdbcompression yes

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

8 dbfilename dump.rdb

Specifies the local database file name, which defaults to dump.rdb

9 dir. /

Specify the local database storage directory

10 slaveof

Set the IP address and port of the master service when the machine is a slave service. When Redis starts, it automatically synchronizes data from master.

11 masterauth

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

12 maxclients 128

Set the maximum number of client connections at a time. By default, there is no limit. The number of client connections that Redis can open at the same time is the maximum number of file descriptors that can be opened by Redis processes. If you set maxclients 0, there is no limit. When the number of client connections reaches the limit, Redis closes the new connection and returns a max number of clients reached error message to the client

13 maxmemory

Specify the maximum memory limit of Redis. Redis will load data into memory at startup. After reaching the maximum memory, Redis will first try to clear the expired or expiring Key. When this method is processed, the maximum memory setting is still reached, and the write operation cannot be performed, but the read operation can still be performed. Redis's new vm mechanism stores Key in memory and Value in swap area.

14 appendonly no

Specifies whether to log after each update operation. Redis writes data to disk asynchronously by default. If it is not enabled, it may result in data loss for a period of time in the event of a power outage. 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

15 vm-enabled no

All data larger than vm-max-memory is stored in virtual memory, no matter how small the vm-max-memory setting is, all index data is stored in memory (Redis's index data is keys), that is, when vm-max-memory is set to 0, all value actually exists on disk. Default value is 0

16 include / path/to/local.conf

Specify to include other profiles that can use the same profile between multiple Redis instances on the same host, while each instance has its own specific profile

At this point, I believe you have a deeper understanding of "what are the parameters of Redis?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report