Redis - ERR DEBUG command not allowed的问题

小结

Redis的调试指令返回权限不允许的错误(ERR DEBUG command not allowed),进行了解决。

问题

redis-cli -p 6379 DEBUG sleep 30指令返回ERR DEBUG command not allowed,如下:

john@XYZ:~$ redis-cli -p 6379 DEBUG sleep 30
(error) ERR DEBUG command not allowed. If the enable-debug-command option is set to "local", you can ru server.

解决

参考How to fix Redis Error “ERR DEBUG command not allowed.”还是无法解决。

开始误以为文件配置有问题/etc/redis/redis.conf,修改enable-debug-commandyes.

john@XYZ:~$ sudo vim /etc/redis/redis.conf
enable-debug-command yes

注意在WSL的Ubuntu中systemctl指令是不起作用的,可以使用sudo service redis-server restart指令进行重启。

进行了以上配置,还是会有同样的ERR DEBUG command not allowed错误。
细究原因是Redis-server启动方式不对,我使用了sudo redis-server --port 6379指令启动Redis,导致了enable-debug-command yes的配置没有生效,正确的启动方式是sudo service redis-server restart

最后的测试结果如下:

john@XYZ:~$ redis-cli -p 6379 DEBUG sleep 30
OK
john@XYZ:~$ redis-cli
127.0.0.1:6379> DEBUG POPULATE 10 Test
OK
127.0.0.1:6379> keys Test*
 1) "Test:8"
 2) "Test:7"
 3) "Test:2"
 4) "Test:9"
 5) "Test:1"
 6) "Test:5"
 7) "Test:0"
 8) "Test:6"
 9) "Test:4"
10) "Test:3"
127.0.0.1:6379> exit


参考

How to fix Redis Error “ERR DEBUG command not allowed.”
How to Install Redis on Ubuntu + Configuration and Common Redis Commands

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值