Ubuntu下启动 Redis时, 提示 "Can't open the log file: Permission denied failed"

时间:2021-12-19 20:53:23

  问题来源:在删除var目录下的log文件时,将redis文件夹删除了。然后在重启时:/etc/init.d/redis-server start,提示:

Starting redis-server: 

*** FATAL CONFIG FILE ERROR *** Reading the configuration file, at line 94 >>> 'logfile /var/log/redis/redis-server.log' Can't open the log file: No such file or directory failed。好吧,于是 touch /var/log/redis/redis-server.log后,再重启时,提示: Starting redis-server: 
*** FATAL CONFIG FILE ERROR ***
Reading the configuration file, at line 94
>>> 'logfile /var/log/redis/redis-server.log'
Can't open the log file: Permission denied
failed
查了一下,最终发现有可能是权限不够的问题,于是,ls -l /var/log/redis/redis-server.log 提示:-rw-r--r-- 1 root root 0  6月  2 10:05 /var/log/redis/redis-server.log。如下图所示: Ubuntu下启动 Redis时, 提示 "Can't open the log file: Permission denied failed"
   解决办法:  chmod 777 /var/log/redis/redis-server.log  再重启,显示成功。问题得到解决 Ubuntu下启动 Redis时, 提示 "Can't open the log file: Permission denied failed"