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

The method of banning several dangerous orders in redis

2025-03-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The customer has been reflecting to me a problem these days, that is, his cache server redis cleans the library every day. I wonder that the redis I configure is generally the default and should not clean the library every day. I think there should be something wrong with his program.

However, regardless of the program problem or the configuration problem, I thought that the command to clear the library could be banned, so even if his program had to be cleaned, there was no way, so I took a look at Baidu and saw that all the relevant documents were written by one person, that is, to use rename-conmand in redis.conf.

Rename-command FLUSHALL "" rename-command FLUSHDB "" rename-command KEYS ""

After that, I went to restart redis and thought I had OK. I looked at redis's log carefully and found that there was a problem.

Unknown command 'flushall' reading the append only file

This is what question, direct Baidu, there is no answer to this question, take a closer look at append only this, I feel where I have seen it, so I went to the redis.conf file to find it. Sure enough, I went to the official website to see the meaning of this parameter.

# # APPEND ONLY MODE # # by default, Redis exports data to disk asynchronously. This mode is good enough for many applications, but a failure or power outage of the Redis process # may result in a loss of writes for a period of time (depending on the configured save instructions). # # AOF is a more reliable alternative persistence mode, such as using the default data write file policy (see configuration below) # Redis# can lose only 1 second of write operation when it encounters unexpected events such as server power outage or write-only situation where the Redis process itself has problems but the operating system is still running normally. # # AOF and RDB persistence can be started at the same time without problems. # if AOF is enabled, Redis will load the AOF file at startup, which can better ensure the reliability of the data. # # Please check http://redis.io/topics/persistence for more information. Appendonly no # Pure cumulative file name (default: "appendonly.aof") appendfilename "appendonly.aof"

So, with the idea of taking a chance, changed the configuration appendonly yes to no, restart redis, sure enough without any error, and the three commands were also disabled.

The method of banning several dangerous orders in redis above is all the content shared by the editor. I hope I can give you a reference and I hope you can support it.

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