1、環境安裝與準備:需要提前安裝python、pip,安裝過程此處省略
2、pip install supervisor
3、安裝完畢會在python的安裝目錄生成3個文件supervisord、supervisorctl、echo_supervisor_conf,這三個程序分別是:守護程序、supervisor客戶端、創建默認supervisor的配置文件
4、創建配置文件存放目錄:sudo mkdir /soft/supervisor/conf.d 目錄沒有先創建目錄
5、使用echo_supervisor_conf生成默認配置,分別執行以下命令:
cd python3/bin
echo_supervisor_conf > /soft/supervisor/conf.d/supervisored.conf
6、啓動supervisor:supervisord -c /soft/supervisor/conf.d/supervisord.conf
7、報錯
[root@localhost apps]# supervisord -c /soft/supervisor/conf.d/supervisord.conf
-bash: supervisord: command not found
8、錯誤7的解決方案
/python3.6.5/bin/supervisord -c /soft/supervisor/supervisord.conf
9、報錯
Error: .ini file does not include supervisord section
For help, use /python3.6.5/bin/supervisord -h
10、錯誤9的解決方案:在supervisord.conf的配置文件中添加以下三行配置(直接複製放進去就行了)
[supervisord]
nodaemon=true
[supervisorctl]
11、啓動,使用如下命令,當然如果你的配置文件直接放在/etc下面,啓動是可以不加-c的參數
sudo /python3.6.5/bin/supervisord -c /soft/supervisor/supervisord.conf