環境:ubutu 15.10python
搭建步驟:shell
sudo apt-get install python-setuptoolsspa
easy_install supervisor日誌
echo_supervisord_conf > /etc/supervisord.conf #根據配置文件模板生成supervisor配置文件code
supervisor.conf文件中輸入須要監控的配置以監控hiveserver爲例server
[program:hiveserver];監控程序名稱 user=jeff;程序啓動用戶 command=/opt/meicai/software/hive/bin/hiveserver2 >> /home/meicai/hiveserver.log;啓動命令 directory=/opt/meicai/software/hive/bin/ autoresetart=true redirect_stderr=true stdout_logfile=/home/meicai/hiveserver.log;運行日誌
特別注意:被supervisor監控的進程不要在結尾出現&,supervisor沒法監控後臺程序。進程
相關命令:get
supervisord -c /etc/supervisor.conf //啓動supervisor服務模板
supervisorctl reload //從新加載supervisor服務class
supervisorctl tail hiveserver //試啓動hiveserver,若是報錯會在配置文件指定的log文件中有詳細錯誤
supervisorctl start hiveserver//啓動服務