PID 文件不一致导致 REDIS 一直重启
问题现象:Redis 服务每隔几十秒自动重启,systemd 状态显示为 activating,无法正常进入 active(running) 状态。

排查过程:
(1)日志显示没有找到/var/run/redis/redis-server.pid 文件,查看这个文件,还真不存在。
PIDFile /var/run/redis/redis-server.pid not found

(2)怀疑是redis进程出啥问题了,所以手动启动redis,发现又是正常的。
如果 systemd 启不起来,但手动启动没问题,大概率 是 systemd 配置问题
redis-server /etc/redis/redis.conf


(3)所以查看配置文件里面的pid文件和systemd中的是否一致。
grep pidfile /etc/redis/redis.confsystemctl cat redis-server.service


(4)发现配置文件中的pid 文件路径和systemd中的不一致,所以修改配置文件中的pidfile文件路径后,正常启动。

