wget http://download.redis.io/releases/redis-4.0.6.tar.gz
tar -zxvf redis-4.0.6.tar.gz
yum install gcc
cd redis-4.0.6
make MALLOC=libc
cd src && make install
cd redis-4.0.6
vim redis.conf
將 daemonize 改為yes
指定 redis 啟動目錄 ./redis-server /usr/local/redis-4.0.6/redis.conf
redis 啟動成功
yum install python-setuptools // 安裝 python easy_install
easy_install supervisor // 安裝 supervisor
echo_supervisord_conf > /etc/supervisord.conf // 生成配置檔案
mkdir -p /etc/supervisor/conf.d/ // 建立相應的專案目錄
vim /etc/supervisord.conf 將[include] 註釋開啟 files = /etc/supervisor/conf.d/*.conf
這樣, supervisor 會載入 /etc/supervisor/conf.d/ 下的所有 .conf 檔案
下載 centos 自動啟動服務指令碼
wget -O /usr/lib/systemd/system/supervisord.service https://github.com/Supervisor/initscripts/raw/master/centos-systemd-etcs
將 supervisord 服務設為自啟動
systemctl enable supervisord.service
生成 laravel 佇列檔案
vim /etc/supervisor/conf.d/laravel-work.conf
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /專案路徑/artisan queue:work redis --sleep=3 --tries=3
autostart=true
autorestart=true
user=root
numprocs=8
redirect_stderr=true
stdout_logfile=/專案路徑/storage/logs/queue.log
啟動 supervisor 服務
supervisord
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start laravel-worker:*
至此 全部安裝完畢 後臺自動執行 redis 佇列
本作品採用《CC 協議》,轉載必須註明作者和本文連結