日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > centos >内容正文

centos

Centos7.x 安装 Supervisord

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

?

?

【環(huán)境】

系統(tǒng):Centos 7.3

軟件:supervisord

?

【安裝Supervisord】

yum install epel-release yum install -y supervisor

【設(shè)置開啟自啟】

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)控】

然后設(shè)置監(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,如果不強(qiáng)制終止,則不會停止,接下來配置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端口通過防火墻或者關(guān)閉防火墻,關(guān)閉selinux,把supervisord.conf中的port=127.0.0.1:9001中的127.0.0.1修改成IP地址重啟服務(wù)進(jìn)行訪問

【W(wǎng)eb端登陸】

?

?【登陸成功】

?

?

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

?

轉(zhuǎn)載于:https://www.cnblogs.com/willamwang/p/11447404.html

總結(jié)

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

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。