Batch taken redis key / value and bulk delete key

Demand: Remove all the key and prefix string type of value g.at.ga.
achieved:
1. Remove key
Redis -p-CLI -n 0 26379 123456 Keys g.at.ga. -a *> a.txt
2. the command value is taken spell
Sed 'S / ^ / & GET / G' a.txt> b.txt
3. take value
CAT b.txt | -a Redis 26379 123456 -p-CLI the --pipe -n 0 > C.txt
4. the key, value makes up a file
paste a.txt c.txt> d.txt

Requirement 2: bulk delete key (to delete key has been exported to a file)
to achieve:
1. key file renamed
mv vsp_article_watch_add_score.log vsp_article_watch_add_score.log.1
2. stitching delete key command
sed 's / ^ / unlink & / G 'vsp_article_watch_add_score.log.1> vsp_article_watch_add_score.log
3. perform bulk delete
cat vsp_article_watch_add_score.log | redis-cli -p 26379 -a 123456 -n 0 --pipe

Published 370 original articles · won praise 599 · Views 2.18 million +

Guess you like

Origin blog.csdn.net/wzy0623/article/details/104073928