解决报错:Redis ERR unknown command ‘FLUSHDB‘

Redis ERR unknown command 'FLUSHDB'

报错信息:

shell 复制代码
ERR unknown command `flushdb`
ERR unknown command `flushall`

解决方案:

我的redis版本是 5.0.7

  1. 修改配置文件

打开 /etc/redis/redis.conf 文件,将下面两行代码注释掉

shell 复制代码
rename-command FLUSHALL 37_dba_FLUSHALL
rename-command FLUSHDB 37_dba_FLUSHDB

注意:我在网上看到重命名为空 rename-command FLUSHALL "" ,我自己测试是不行的。

如果注释以后重启服务成功,那就不需要执行第二步了。

  1. 删除AOF文件

我的 aof 文件在 /var/lib/redis/ 目录下,将其删掉。

shell 复制代码
rm -f appendonly.aof

如果没有这一步,启动服务报错,具体内容是:

shell 复制代码
7042:M 03 Aug 2023 10:13:58.973 * Reading RDB preamble from AOF file...
7042:M 03 Aug 2023 10:13:58.973 * Reading the remaining AOF tail...
7042:M 03 Aug 2023 10:13:59.222 # Unknown command '37_dba_FLUSHDB' reading the append only file
  1. 重启服务
shell 复制代码
sudo service redis restart
相关推荐
wang6021252183 分钟前
FastAPI框架为什么在启动时建表
数据库
男孩李5 分钟前
linux下如何执行postgres数据库的sql文件
数据库·sql·postgresql
zwjapple9 分钟前
MySQL SQL 面试核心考点与注意事项总结
数据库·sql·mysql
乐韵天城10 分钟前
SpringBoot中如何手动开启数据库事务
数据库·spring boot
05大叔16 分钟前
Spring Day02
数据库·sql·spring
jmxwzy20 分钟前
点赞系统问题
java·redis·tidb·pulsar
默默前行的虫虫22 分钟前
nicegui中多次调用数据库操作总结
数据库·python
鸽鸽程序猿28 分钟前
【Redis】事务
数据库·redis·缓存
Knight_AL1 小时前
MySQL 分区表应用案例:优化数据管理与性能
数据库·mysql
东东的脑洞1 小时前
【面试突击】Redis 主从复制核心面试知识点
redis·面试·职场和发展