天天看點

CentOS7配置Supervisor

1. 安裝 Supervisor

2. 配置 Supervisor

3.啟動 Supervisor #非必須執行

4. 應用配置

supervisorctl執行錯誤

5. Supervisor 管理程序

Web管理

Supervisor 的文檔位址:http://www.supervisord.org/

Supervisor 的配置檔案為:​<code>​/etc/supervisord.conf​</code>​

Supervisor 所管理的應用的配置檔案放在​<code>​/etc/supervisord.d/​</code>​目錄中,這個目錄可以在 supervisord.conf 中配置。

CentOS7配置Supervisor

通過這種方式啟動,伺服器重新開機後 Supervisor 不會自動啟動,不建議使用這種方式啟動Supervisor。

安裝 Supervisor 後,在​<code>​/usr/lib/systemd/system/​</code>​目錄中會有一個​<code>​supervisord.service​</code>​檔案,内容如下:

CentOS7配置Supervisor

如果沒有,在該目錄中建立一個,用下面的内容替換:

寫入服務内容

常用指令

如果在啟動的時候遇到如下錯誤:

​<code>​Another program is already listening on a port that one of our HTTP servers is configured to use. Shut this program​</code>​

使用以下指令:

Supervisor 管理應用的程序,需要對每個應用進行配置。在​<code>​/etc/supervisor.d​</code>​中建立helloworld.ini,每個應用對應一個配置檔案即可。

下面是配置檔案的示例:

配置檔案中的程式盡量在​<code>​/usr/bin/​</code>​中或加path

建立好配置檔案後,重新開機 Supervisor

出現 error: &lt;class ‘socket.error’&gt;, [Errno 2] No such file or directory: file: /usr/lib64/python2.7/socket.py line: 224 錯誤

————————————————

轉自連結:https://learnku.com/articles/48865

同時要保證*.ini 配置檔案中的空格,程式路徑,目錄是否正确/存在

為確定沒有錯誤,可以正常啟動,使用前文提到的檢視Supervisor狀态的指令檢視。或者檢視要管理的程序是否啟動,本例中可以使用下面的指令:

有兩種方式可以管理程序,指令行和Web管理。

啟用 Web 管理,首先将/etc/supervisord.conf配置檔案中的inet_http_server節點取消注釋。

下面是第三方Supervisor的Web管理工具:

cesi :https://github.com/Gamegos/cesi

suponoff:https://github.com/GambitResearch/suponoff

gosuv:https://github.com/codeskyblue/gosuv

supervisord-monitor:https://github.com/mlazarov/supervisord-monitor

supervisord-monitor改進版:https://github.com/WisZhou/supervisord-monitor

繼續閱讀