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

How to configure Redis

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

Share

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

This article mainly introduces "how to configure Redis". In daily operation, I believe many people have doubts about how to configure Redis. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "how to configure Redis"! Next, please follow the editor to study!

Redis.conf file

Generally speaking, only the following points need to be modified to explain the functions of each place:

1.bind IP (Note: bind 127.0.0.1 cannot be preceded by spaces, same as below)

Bind 127.0.0.1

Bind 192.168.60.130

This is where IP, the server bound to redis, is used for virtual machines and other client programs to access redis normally.

2.protected-mode yes

This is to turn on the protected mode, which is on by default and only allows local client connections. You can set a password or add bind to connect. This has something to do with the requirepass item.

Requirepass sfitdba

3.daemonize yes

Redis does not run as a daemon by default, so if you want it to run in the background, you can change it to yes. When redis runs as a daemon, it writes a pid to the redis.pid file (pid name is shown below)

4.pidfile "/ var/run/redis/redis1.pid"

This is to specify the pid file path. Note that you need to create a folder under the run path now to ensure that the path is correct.

5.logfile "/ var/log/redis/redis1.log"

This is to specify the path to the log file, as above, you need to create a folder to make sure the path is correct.

6. How often do you save DB to disk:

Save 100 1

# save 200 10

# save 60 10000

Format: save

If the value of at least 1 key changes within 100 seconds, save

If the value of at least 10 key changes within 200 seconds, save

Note: you can disable the save function by commenting out all save lines.

You can also deactivate it by simply using an empty string:

Save ""

7.dir "/ usr/local/redis1/data"

This is to specify the data storage path for redis. Note that you need to create a folder to make sure the path is correct.

At this point, the study on "how to configure Redis" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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