supervisor配置使用

环境:ubutu 15.10

搭建步骤:

  1. sudo apt-get install python-setuptools

  2. easy_install supervisor

  3. echo_supervisord_conf > /etc/supervisord.conf #根据配置文件模板生成supervisor配置文件

  4. supervisor.conf文件中输入需要监控的配置以监控hiveserver为例

[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无法监控后台程序。

相关命令:

supervisord -c /etc/supervisor.conf //启动supervisor服务

supervisorctl reload //重新加载supervisor服务

supervisorctl  tail hiveserver //试启动hiveserver,如果报错会在配置文件指定的log文件中有详细错误

supervisorctl  start hiveserver//启动服务


你可能感兴趣的:(supervisor配置使用)