unix linux 服务器 supervisord安装使用 - [inet_http_server] #web页面端口

📅 2026-11-30 👤 拼多多助力营销技巧 📂 手赚APP 👁️ 200 次阅读

supervisord安装使用

supervisord简介:

supervisord是一个c/s模式的进程管理程序,它可以用来监控应用程序的进程,并且可以管理应用程序的start/stop/restart/reload等功能。

安装supervisord:

root@dokcer:~# apt-get install supervisord -y #apt安装supervisord

root@dokcer:~# supervisord -v #supervisord版本

3.3.1

supervisord配置文件:

supervisord配置文件默认路径:/etc/supervisor/supervisord.conf

root@dokcer:~# vim /etc/supervisor/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)

[supervisord]

logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)

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/conf.d/*.conf #进程监控配置路径

[inet_http_server] #web页面端口

port=*:9080 #web页面地址:9080或*:9080

username=admin #web页面的用户名和密码

password=admin

supervisord监控进程配置文件:

#配置监控的应用程序:

root@dokcer:~# vim /etc/supervisor/conf.d/prometheus.conf

#用户程序为prometheus

[program:prometheus]

#启动命令,不能使用nohup等后台运行命令否则应用程序会无限重启

command=/usr/local/prometheus/prometheus --config.file=/usr/local/prometheus/prometheus.yml

autostart=true #自动启动

autorestart=true #自动重启

process_name=prometheus #进程名称

startretries=5 #尝试启动的次数

启动supervisord程序:

root@dokcer:~# systemctl start supervisor.service #

打开http://IP:9080,输入用户名和密码就可以在web页面查看监控的应用程序:

supervisordctl命令行

命令参数作用supervisorctlstop program:name停止配置文件中的某个应用程序supervisorctlstart program:name启动配置文件中的某个应用程序supervisorctlrestart program:name重启配置文件中的某个应用程序supervisorctlstop all停止全部进程supervisorctlrelod载入新配置文件然后启动应用程序supervisorctlupdate载入新配置文件启动,没有改变就不重启进程supervisorctltail program:name查看应用程序的日志

root@dokcer:~# supervisorctl start prometheus

prometheus: started

root@dokcer:~# supervisorctl stop prometheus

prometheus: stopped

root@dokcer:~#

相关链接

标签: 拼多多助力网站平台 赚钱项目 拼多多助力网 首码项目 手赚APP
拼多多助力营销技巧