The installation supervisor
yum install supervisor
It is usually installed in /etc/to generate a supervisor. conf file and the supervisor. d directory where configuration files are normally placed
Open the /etc/supervisor.conf file, which will appear on the last line
[include]
files = supervisord.d/*.ini
The supervisord.d folder is loaded with all.ini files in it
So I’ll write my configuration right here
Create a laravel-worker.ini file with the following contents. The parameters can be changed according to your actual situation
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /data/www/YouProjectDirectory/artisan queue:work --sleep=3 --tries=3
autostart=true
autorestart=true
user=apache
numprocs=8
redirect_stderr=true
stdout_logfile=/data/www/YouProjectDirectory/storage/logs/worker.log
The numprocs Supervisor tells the eight queue:work processes to run and monitor them, and automatically restarts them if they fail. Of course, you need to modify the queue:work SQS command to map your queue connections
After the configuration file is created, refresh the Supervisor’s configuration information and start the process with the following command:
sudo supervisord
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start laravel-worker:*
If you start Times laravel-worker: Added process group error, it is possible that you have made a mistake in the configuration file section. Check if your.ini configuration file is in the correct location. It will normally be placed in the supervisord. directory, and will be able to do so instead. The supervisor. conf file is designed to be stored in the container, but you have not changed the location of the include file in the container
The SystemCTL Enable supervisord is designed to enable the supervisord
2021.06.10 Nanjing West Road, Shanghai