redis-报错(error) ERR Errors trying to SHUTDOWN. Check logs.

方法1

网上给出了很多查看log的方法,基本思路先看有没有关闭的权限。然后是将redis.conf中的log和dbfile路径修改得到一定的log信息。

1.打开配置文件redis.conf 我的在/etc/redis 下

需要注意对于那些mac使用brew安装的用户们

redis.conf的路径在

# 部分用户的是在/usr/local/etc下
/etc/redis

而不是在文件夹下。

而使用wget或者其他安装方法的用户一般是到安装路径或者解压路径上

2.修改log路径(此步奏是为了查看使用 shutdown 指令 出错在哪)

vim redis.conf 

找到 logfile “”

修改为:

logfile /usr/local/redis/redis_log/redis_log.log

如果/usr/local/redis 下面没有相应的文件夹和文件对应创建且 赋予读写权限使用指令: sudo chmod 777 redis_log.log

3.将dir /. 修改为dir/usr/local/redis/redis_dbfile/即:

dir /usr/local/redis/redis_dbfile/

4.若使用shutdown 还是显示(error) ERR Errors trying to SHUTDOWN. Check logs. 则可以查看redis_log.log文件

解决后即可以使用 shutdown 指令显示 not connected即代表成功

方法2

下面给出一个暴力的解决方法:

1.查看进程号pid

注意:下面命令中的my_account是你的用户名

ps -u my_account -o pid,rss,command | grep redis

2.杀死redis

注意:下面命令中的the_pid是我们第一步查到的redis的进程号

kill -9 the_pid


评论