栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

Supervisor管理hhvm进程

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Supervisor管理hhvm进程

hhvm速度很快,但由于与网站程序兼容性或hhvm本身不成熟,跑一段时间后会出现hhvm宕掉,使前台页面出现502 bad gateway。为了防止hhvm进程自动宕掉,我们可以用Supervisor来管理hhvm进程,它会在hhvm宕掉后自动启动hhvm进程。

Supervisor已经加到《lnmp一键安装包》和《OneinStack》,欢迎测试。

HHVM相关教程请参考如下:

CentOS 7下hhvm Nginx环境搭建:linuxeye.com/402.html

CentOS 6下hhvm Nginx环境搭建:linuxeye.com/396.html

Supervisor简介

Supervisor是一个Python开发的client/server系统,可以管理和监控*nix上面的进程。

部件:Supervisor有不同的部件组成,部件分别负责不同的功能,对进程进行监控和管理。

supervisord:Supervisor的server部分称为supervisord。主要负责管理子进程,响应客户端的命令,log子进程的输出,创建和处理不同的事件

supervisorctl:Supervisor的命令行客户端。它可以与不同的supervisord进程进行通信,获取子进程信息,管理子进程

Web Server:Supervisor的web server,用户可以通过web对子进程进行监控,管理等等,作用与supervisorctl一致。

XML-RPC inteface:XML-RPC接口,提供XML-RPC服务来对子进程进行管理,监控

安装Supervisor

安装supervisor很简单,通过easy_install就可以安装

    yum -y install python-setuptools
    easy_install supervisor

安装完成之后,就可以用echo_supervisord_conf命令来生成配置文件

    echo_supervisord_conf > /etc/supervisord.conf
配置supervisor管理hhvm进程

vi /etc/supervisord.conf

pidfile=/tmp/supervisord.pid 改成pidfile=/var/run/supervisord.pid

#并在/etc/supervisord.conf后面追加如下内容:

    [program:hhvm]
    command=/usr/bin/hhvm --mode server --user www --config /etc/hhvm/server.ini --config /etc/hhvm/php.ini --config /etc/hhvm/config.hdf
    numprocs=1 ; number of processes copies to start (def 1)
    directory=/tmp ; directory to cwd to before exec (def no cwd)
    autostart=true ; start at supervisord start (default: true)
    autorestart=unexpected ; whether/when to restart (default: unexpected)
    stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10)
supervisor开机脚本
    wget https://github.com/Supervisor/initscripts/raw/master/redhat-init-mingalevme
    /bin/mv redhat-init-mingalevme /etc/init.d/supervisord
    chmod +x /etc/init.d/supervisord
    chkconfig supervisord on  #开机自启动
    service supervisord restart  #启动
测试Supervistor Thu Jan 15 14:03:54 CST 2015
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/10182.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号