我的服务器重新启动了一下,发现我的远程的 redis 连接不上了,然后我登陆上服务器也无法启动,然后报错信息为:
Job for redis.service failed because the control process exited with error code. See "systemctl status redis.service" and "journalctl -xe" for details.
简直不要太头疼,而且我还重装了好几次 redis 还是没有用,看来硬来是不行的,于是我仔细观察这个错误,他让输入“journalctl -xe”来查看详情,于是我输入后便显示:
- Subject: Unit redis.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit redis.service has begun starting up.
Nov 22 16:32:16 VM_0_13_centos redis-server[30158]: *** FATAL CONFIG FILE ERROR ***
Nov 22 16:32:16 VM_0_13_centos redis-server[30158]: Reading the configuration file, at line 163
Nov 22 16:32:16 VM_0_13_centos redis-server[30158]: >>> 'logfile /var/log/redis/redis.log'
Nov 22 16:32:16 VM_0_13_centos redis-server[30158]: Can't open the log file: Permission denied
Nov 22 16:32:16 VM_0_13_centos systemd[1]: redis.service: main process exited, code=exited, status=1/FAILURE
Nov 22 16:32:16 VM_0_13_centos redis-shutdown[30160]: Could not connect to Redis at 127.0.0.1:6379: Connection refused
Nov 22 16:32:16 VM_0_13_centos polkitd[2500]: Unregistered Authentication Agent for unix-process:30152:6677862 (system bus name :1.2402, object path /org/free
Nov 22 16:32:16 VM_0_13_centos systemd[1]: redis.service: control process exited, code=exited status=1
Nov 22 16:32:16 VM_0_13_centos systemd[1]: Failed to start Redis persistent key-value database.
-- Subject: Unit redis.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit redis.service has failed.
--
通过仔细的阅读,说是无法打开 log file 因为权限不允许,也就是这句
Can't open the log file: Permission denied
那么我们只需要把权限给这个文件就好了,因为这个文件是属于 root 组的,而运行 redis 后变成 redis 组的了。
输入:
chown redis:redis /var/log/redis/redis.log
再次启动 redis
systemctl start redis
那么你就会发现这次没啥问题了,总结:一定要好好的看日志文件,不要盲目的上网搜索错误,因为网上的错误很可能给你的错误并不匹配。
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于