首页 > 数据库 >解决报错:Redis ERR unknown command ‘FLUSHDB‘

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

时间:2023-08-07 12:37:58浏览次数:37  
标签:ERR unknown redis FLUSHDB 报错 command


Redis ERR unknown command ‘FLUSHDB’

报错信息:

ERR unknown command `flushdb`
ERR unknown command `flushall`

解决方案:

我的redis版本是 5.0.7

  1. 修改配置文件

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

rename-command FLUSHALL 37_dba_FLUSHALL
rename-command FLUSHDB 37_dba_FLUSHDB

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

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

  1. 删除AOF文件

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

rm -f appendonly.aof

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

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. 重启服务
sudo service redis restart


标签:ERR,unknown,redis,FLUSHDB,报错,command
From: https://blog.51cto.com/u_12215673/6992412

相关文章