How to delete data by mode in Redis

  
 

A Redis server consumes tens of Gigabytes of memory in a short period of time and eventually crashes due to SWAP. Because the social background of this server is more complicated, it is impossible to judge who the suspect is.


The initial intuition is that some people have saved a lot of data, so the problem becomes to find out which keys take up a lot of space, DBA colleagues used redis-rdb Tools such as -tools to analyze data files. It is a pity that although some large-volume keys were found, the suspects were eventually ruled out and the problem seemed to be deadlocked.

After being insinuated into a dead end, we began to adjust the angle of the investigation: even if the space occupied by a key itself is not large, if the number of keys in the same mode is large, then the total will take up a lot of space. Then the problem becomes a lot of space to find out which keys of the same mode take up. This time I don't want to use any tools, but I want to check the memory changes while deleting the suspicious keys on the test server:

shell> /path/to/redis-cli keys foo:* 
						
Copyright © Windows knowledge All Rights Reserved