美文网首页
Supervisor安装

Supervisor安装

作者: 袁先生的笔记 | 来源:发表于2017-05-08 19:04 被阅读0次

环境

系统:CentOS 7.8

方法一:使用pip安装

  • 安装pip

  • 安装

    # pip install supervisor
    
  • 生成主配置

    # echo_supervisord_conf > /etc/supervisord.conf
    
    # vim /etc/supervisord.conf
    [unix_http_server]
    file=/var/run/supervisor.sock
    
    [supervisord]
    pidfile=/var/run/supervisor.pid
    
    [supervisorctl]
    serverurl=unix:///var/run/supervisor.sock
    
    [include]
    files=/etc/supervisor/*.ini
    
  • 添加启动服务

    # vim /usr/lib/systemd/system/supervisord.service
    [Unit]
    Description=Process Monitoring and Control Daemon
    After=rc-local.service nss-user-lookup.target
    
    [Service]
    Type=forking
    ExecStart=/usr/bin/supervisord -c /etc/supervisord.conf
    
    [Install]
    WantedBy=multi-user.target
    

方法二:使用yum安装

  • 安装
    # yum install supervisor
    

配置被管理进程

# vim /etc/supervisor/my_app.ini
[program:my_app]
command=/usr/local/jdk/bin/java -jar my_app.jar
directory=/data/app/%(program_name)s
user=root
redirect_stderr=true
stdout_logfile=/data/logs/%(program_name)s.log
stdout_logfile_maxbytes=500MB

启动

# systemctl enable supervisord.service
# systemctl start supervisord.service

相关文章

网友评论

      本文标题:Supervisor安装

      本文链接:https://www.haomeiwen.com/subject/vpcvtxtx.html