2021-06-10 | UNLOCK

解决 Redis 服務 Can't open PID file

更新 v2board 至最新 dev 版

1
2
3
4
5
6
git fetch --all && git reset --hard origin/dev && git pull origin dev
php composer.phar update -vvv
php artisan v2board:update
php artisan config:cache
pm2 restart pm2.yaml
pm2 save

修改 Redis.service

若更新後無法進入面版,需要修改 redis.service

1
nano /etc/systemd/system/redis.service

[Service] 加入 ExecStartPost=/bin/sh -c "echo $MAINPID > /var/run/redis/redis.pid" 傳遞 PID 參數給 redis,即可避免此 bug

1
2
3
4
5
6
[Service]
Type=forking
ExecStart=/usr/bin/redis-server /etc/redis/redis.conf
ExecStop=/bin/kill -s TERM $MAINPID
ExecStartPost=/bin/sh -c "echo $MAINPID > /var/run/redis/redis.pid"
PIDFile=/run/redis/redis-server.pid

保存設置重啟

1
2
systemctl daemon-reload
systemctl restart redis

v2board 問題排查思路

  1. v2board 路徑是否設置遞歸 755 權限
  2. php7.x-fpm.serviceredis-server.service 是否正常運行
  3. PM2 隊列是否正常啟動
  4. composer 組件是否均正確安裝

Reference

  1. Redis Daemon not creating a PID file

評論加載中