日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

Centos7.x 安装 Supervisord

發(fā)布時間:2025/10/17 77 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Centos7.x 安装 Supervisord 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

?

?

【環(huán)境】

系統(tǒng):Centos 7.3

軟件:supervisord

?

【安裝Supervisord】

yum install epel-release yum install -y supervisor

【設置開啟自啟】

systemctl enable supervisord

【Supervisord管理命令】

systemctl stop supervisord systemctl start supervisord systemctl status supervisord systemctl reload supervisord systemctl restart supervisord

【修改配置文件,使Supervisord可以在web端顯示】

vim /etc/supervisord.conf

#取消10-13行注釋,前面數(shù)字是行號 10 [inet_http_server] ; inet (TCP) server disabled by default 11 port=127.0.0.1:9001 ; (ip_address:port specifier, *:port for all iface) 12 username=user ; (default is no username (open server)) 13 password=123 ; (default is no password (open server))

【監(jiān)控】

然后設置監(jiān)控文件以及腳本等

比如我們創(chuàng)建一個死循環(huán),讓腳本來監(jiān)控,這里拿python來說吧

在home目錄下創(chuàng)建一個while循環(huán)的py文件

vim /home/test.py

while True:print(100)

這個文件一直打印100,如果不強制終止,則不會停止,接下來配置supervisord。我們可以通過配置文件最后一行看到

cat /etc/supervisord.conf

[include] files = supervisord.d/*.ini

也就是說,我們所有的配置文件都保存在這個目錄下,以.ini格式命名保存的,可以自行修改地址,但不要修改后綴,那我們來創(chuàng)建supervisor文件吧

【創(chuàng)建Supervisord文件】

vim /etc/supervisord.d/python.ini

[program:python] #這里的python就是我們顯示在web前端以及終端的監(jiān)控名稱 command=python /home/test.py #我們要監(jiān)控的文件地址 autostart=true autorestart=true startsecs=1 startretries=3 redirect_stderr=true stdout_logfile=/etc/supervisord.log/access_python.log #日志地址,可自行配置目錄 stderr_logfile=/etc/supervisord.log/error_python.log #日志地址,可自行配置目錄

【啟動Supervisord】

systemctl start supervisord 查看是否啟動 systemctl status supervisord

注:如果啟動成功后無法登陸web端,則允許9001端口通過防火墻或者關閉防火墻,關閉selinux,把supervisord.conf中的port=127.0.0.1:9001中的127.0.0.1修改成IP地址重啟服務進行訪問

【Web端登陸】

?

?【登陸成功】

?

?

登陸之后,會出現(xiàn)如下界面,可以對該文件進行一些操作,打開、停止、查看日志、清除日志

?

轉載于:https://www.cnblogs.com/willamwang/p/11447404.html

總結

以上是生活随笔為你收集整理的Centos7.x 安装 Supervisord的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。