首页 > 代码库 > Unknown command 'flushall' reading the append only file

Unknown command 'flushall' reading the append only file

为了redis cluster禁用一些危险命令,使用的方法都是在配置文件中增加以下内容:

rename-command flushall hufuflushall

rename-command flushdb hufuflushdb

rename-command keys hufukeys

这就带来了问题,在服务器以外重启后,会造成cluster中redis服务启动不了,而且还会报“ Unknown command ‘flushall‘ reading the append only file”。通常的做法关闭启动不了服务的持久化配置“appendonly no”。然后再启动redis实例服务。但会遇到以下问题,连接cluster服务时会提示cluster不可用。这时redis-trib.rb的作用就体现出了,执行fix操作集群服务就能恢复了。但修改持久配置的结果是,再发生关机操作或意外,redis数据就找不回来了。这时还是用redis-trib.rb的add功能为出问题的redis实例增加slave,再通过failover的方式进行master与slave的切换。过程很曲折,但谁让redis-cluster还是个半自动的集群服务哪!

本文出自 “好好生活,快乐工作!” 博客,请务必保留此出处http://yjw1983.blog.51cto.com/265702/1854600

Unknown command 'flushall' reading the append only file