Rocky 9.5 Supervisor 部署安装

1. 添加 EPEL 9 仓库

sudo dnf install epel-release -y

2. 安装 Supervisor

sudo dnf install supervisor -y
sudo systemctl enable supervisor  # 设置开机自启

3.创建 Supervisor 文件夹

sudo mkdir /etc/supervisor

4. 修改 Supervisor配置文件

sudo mv /etc/supervisord.conf /etc/supervisord.conf.bak # 备份原始配置文件
sudo vim /etc/supervisord.conf # 创建新文件

:根据操作系统不同配置文件位置会不同,
Ubuntu 系列系统 : /etc/supervisor/supervisord.conf
Rhel 系列系统 : /etc/supervisord.conf

将以下内容拷贝到supervisord.conf中并保存

; supervisor config file

[unix_http_server]
file=/var/run/supervisor.sock   ; (the path to the socket file)
chmod=0700                       ; sockef file mode (default 0700)

[inet_http_server]         ; inet (TCP) server disabled by default
port=*:9001        ; (ip_address:port specifier, *:port for all iface)
username=root              ; (default is no username (open server))
password=666666               ; (default is no password (open server))


[supervisord]
logfile=/var/log/supervisor/supervisord.log  ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB       ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10          ; (num of main logfile rotation backups;default 10)
loglevel=info         ;
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=/var/log/supervisor            ; ('AUTO' child log dir, default $TEMP)

; the below section must remain in the config file for RPC
; (supervisorctl/web interface) to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL  for a unix socket

; The [include] section can just contain the "files" setting.  This
; setting can list multiple files (separated by whitespace or
; newlines).  It can also contain wildcards.  The filenames are
; interpreted as relative to this file.  Included files *cannot*
; include files themselves.

[include]
files = /etc/supervisor/asys.d/*.conf  /etc/supervisor/conf.d/*.conf

5. 修改进程启动名称(可选)

sudo mv /usr/lib/systemd/system/supervisord.service /usr/lib/systemd/system/supervisor.service

:将 Rhel系列系统当作Ubuntu系列系统使用时需要以上操作。

6.启动 Supervisor

sudo systemctl start supervisor

7.验证运行状态

sudo systemctl status supervisor
posted @ 2025-07-02 16:39  BlackSnow  阅读(117)  评论(0)    收藏  举报