centos【rockylinux】安装【supervisor】的注意事项【完整版】

重新加载 systemd 配置推荐使用pip的方式安装

bash 复制代码
pip install supervisor

第二步:添加supervisord.conf配置文件

bash 复制代码
[unix_http_server]
file=/tmp/supervisor.sock   ; UNIX socket 文件,supervisorctl 会使用
;chmod=0700                 ; socket 文件的 mode,默认是 0700
;chown=nobody:nogroup       ; socket 文件的 owner,格式: uid:gid

; [inet_http_server]         ; HTTP 服务器,提供 web 管理界面
; port=0.0.0.0:8080        ; Web 管理后台运行的 IP 和端口,如果开放到公网,需要注意安全性
; username=root              ; 登录管理后台的用户名
; password=1123               ; 登录管理后台的密码

[supervisord]
logfile=/tmp/supervisord.log ; 日志文件,默认是 $CWD/supervisord.log
logfile_maxbytes=50MB        ; 日志文件大小,超出会 rotate,默认 50MB
logfile_backups=10           ; 日志文件保留备份数量默认 10
loglevel=info                ; 日志级别,默认 info,其它: debug,warn,trace
pidfile=/tmp/supervisord.pid ; pid 文件
nodaemon=false               ; 是否在前台启动,默认是 false,即以 daemon 的方式启动
minfds=1024                  ; 可以打开的文件描述符的最小值,默认 1024
minprocs=200                 ; 可以打开的进程数的最小值,默认 200

; 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:///tmp/supervisor.sock ; 通过 UNIX socket 连接 supervisord,路径与 unix_http_server 部分的 file 一致
; serverurl=http://127.0.0.1:8080 ; 通过 HTTP 的方式连接 supervisord

; 包含其他的配置文件【可以是 *.conf 或 *.ini】
[include]
files = /etc/supervisor/*.conf /etc/supervisor/common/*.conf

第三步:配置 supervisord.service文件

手动创建 supervisord.service

如果 supervisord.service 不存在,你可以手动创建:

bash 复制代码
vim /etc/systemd/system/supervisord.service
bash 复制代码
# supervisord service for systemd (CentOS 7.0+)
# by ET-CS (https://github.com/ET-CS)
[Unit]
Description=Supervisor daemon

[Service]
Type=forking
ExecStart=/usr/local/anaconda3/bin/supervisord
ExecStop=/usr/local/anaconda3/bin/supervisorctl $OPTIONS shutdown
ExecReload=/usr/local/anaconda3/bin/supervisorctl $OPTIONS reload
KillMode=process
Restart=on-failure
RestartSec=42s

[Install]
WantedBy=multi-user.target

重新加载 systemd 配置

bash 复制代码
sudo systemctl daemon-reload

最后tab补全支持【】

bash 复制代码
 yum install bash-completion
bash 复制代码
启用 Bash 补全
确保 Bash 补全已启用。在 ~/.bashrc 或 /etc/bash.bashrc 中添加以下内容:


if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
fi
然后重新加载 Bash 配置:


source ~/.bashrc

最后执行 systemctl restart supervisord.service 补全试试

相关推荐
@菜菜_达31 分钟前
Nginx的安装与配置(window系统)
运维·nginx
wifi chicken32 分钟前
Linux Wlan 无线协议栈开发-传输层详解
linux·网络协议
XH-hui1 小时前
【打靶日记】THL 之 Facultad
linux·网络安全·1024程序员节·thehackerlabs
熙xi.1 小时前
DHT11温湿度传感器Linux驱动开发完整流程
linux·运维·驱动开发
Yyyy4822 小时前
Ubuntu部署 Kubernetes1.23
linux·运维·ubuntu
人工智能训练2 小时前
在 Ubuntu 系统中利用 conda 创建虚拟环境安装 sglang 大模型引擎的完整步骤、版本查看方法、启动指令及验证方式
linux·运维·服务器·人工智能·ubuntu·conda·sglang
☆璇2 小时前
【Linux】网络层协议IP
linux·服务器·tcp/ip
王道长服务器 | 亚马逊云3 小时前
AWS Auto Scaling:自动扩容,让服务器像呼吸一样灵活
运维·网络·自动化·云计算·aws
小蜗牛爱远行3 小时前
服务器和docker容器时间不一致相关问题
运维·服务器·docker
Xの哲學3 小时前
Linux ioctl 深度剖析:从原理到实践
linux·网络·算法·架构·边缘计算