Redis禁用部分危险命令(keys/flushdb等)
在redis.conf文件【SECURITY】区域配置:
1、禁用命令:
rename-command KEYS "" rename-command FLUSHALL "" rename-command FLUSHDB "" rename-command CONFIG ""
2、重命名命令:
rename-command KEYS "xxxxxxxxxxxx" rename-command FLUSHALL "yyyyyyyyyyyyy" rename-command FLUSHDB "qqqqqqqqqqqqq" rename-command CONFIG "aaaaaaaaaaaaaa"
如果需要使用【keys *】功能,可以使用【scan/sscan/zscan/hscan】命令。
具体用法参考官网:https://redis.io/commands/scan