install supervisor in centos
Explain parameter
Sure, let's break down the parameters in this Supervisor configuration file for a Laravel worker process:
1. `program`: This sets the name of the program, in this case, it's named `laravel-worker`.
2. `process_name`: This parameter allows you to define the process name using Python string
formatting syntax. It will create process names like `laravel-worker_01`, `laravel-worker_02`, and so on,
up to the number of processes defined.
3. `command`: This is the actual command that Supervisor will execute to start the program. In this
case, it runs a PHP command to execute Laravel's Artisan CLI tool to work on the queue named `sqs`.
It sets `--sleep=3` which means the worker will sleep for 3 seconds before checking for new jobs again,
and `--tries=3` which means the worker will attempt each job up to 3 times before marking it as failed.
4. `autostart`: This determines whether the program will start automatically when Supervisor starts.
It's set to `true`, so the program will start automatically.
5. `autorestart`: This determines whether the program will be automatically restarted by
Supervisor if it exits unexpectedly. It's set to `true`.
6. `stopasgroup` and `killasgroup`: These parameters ensure that when Supervisor stops or kills the
program, it stops or kills all the processes in the group.
7. `user`: This specifies the user account under which the program will be run. In this case, it's set to
`root`, which means the program will run with root privileges.
8. `numprocs`: This specifies the number of processes that Supervisor will start and manage. In this
case, it's set to `8`, so Supervisor will manage 8 worker processes.
9. `redirect_stderr`: This directs the standard error stream of the program to the same location as standard output.
10. `stdout_logfile`: This specifies the path to the log file where standard output from the program will be written.
11. `stopwaitsecs`: This specifies the number of seconds that Supervisor should wait for the program to
stop gracefully before forcefully terminating it.
This configuration file sets up Supervisor to manage multiple Laravel worker processes that handle
jobs from an SQS queue. It ensures that these processes are automatically started, restarted if they
fail, and managed in a group. The logs of these processes are redirected to a specific file, and they run
with root privileges.
Note :
Point 1 : numprocs parameter normally 0-8 so basic scenario set 1 process at time.
Point 2 : You can create multiple file for same project and you can run different
Different queue for example I have to run different queue then i have create another
File.
Point 3. Whenever the laravel queue and job change please restart supervisor.
Below Useful command description
These commands are related to managing the Supervisord process control system on a Linux system
using the `systemctl` command, which is part of the systemd service manager.
1. `sudo systemctl enable supervisord`: This command enables the Supervisord service to start
automatically at system boot. When enabled, systemd creates symbolic links to the Supervisord
service unit file in the appropriate locations so that it starts during the boot process.
2. `sudo systemctl start supervisord`: This command starts the Supervisord service immediately.
Once started, Supervisord begins managing processes according to its configuration.
3. `sudo systemctl status supervisord`: This command provides information about the status of the
Supervisord service, including whether it is running, any errors encountered, and other relevant information.
4. `sudo systemctl stop supervisord`: This command stops the Supervisord service immediately
, terminating all managed processes. Use this command when you need to stop Supervisord gracefully.
5. `sudo systemctl restart supervisord`: This command stops and then starts the Supervisord service,
effectively restarting it. It's useful when you need to apply changes to Supervisord's configuration or if
the service is misbehaving and requires a restart to function properly.
These commands are commonly used for managing Supervisord, which is a process control system
used to monitor and control processes on Unix-like operating systems. It's often used for managing and
supervising long-running processes and daemon programs.
install supervisor in ubuntu
Note :
Point 1 : numprocs parameter normally 0-8 so basic scenario set 1 process at time.
Point 2 : You can create multiple file for same project and you can run different
Different queue for example I have to run different queue then i have create another
File.
Point 3. Whenever the laravel queue and job change please restart supervisor.
The commands you've provided are related to managing the Supervisor process control system in
Unix-like operating systems.
1. `sudo service supervisor status`: This command checks the status of the Supervisor service, indicating whether it's running or stopped.
2. `sudo service supervisor restart`: This command restarts the Supervisor service. It stops it if it's
running and then starts it again.
3. `sudo service supervisor stop`: This command stops the Supervisor service if it's currently running.
4. `sudo service supervisor start`: This command starts the Supervisor service if it's not already
running.
Supervisor is a client/server system that allows its users to monitor and control a number of processes
on UNIX-like operating systems. It's commonly used to manage processes in web applications, such
as Django or Flask apps, where you need to keep various services running.
If you need a description of Supervisor, it's a process control system used to monitor and control a
number of processes on Unix-like operating systems. It's often used to manage processes related to
web applications, task queues, and background services.
No comments:
Post a Comment
Thank You For Comment