手动安装supervisor进程守护

最近安装CRMEB多商户的时候,需要用到supervisor进程守护,官方只有宝塔安装,自己手动安装记录一下。
点击 多商户源码 了解,账号 demo 密码 crmeb.com,
更多其他项目点击:了解更多
在这里插入图片描述
正文开始:

  1. 安装supervisor

    1.1.安装python的setuptools库

    yum install python-setuptools

    1.2.通过setuptools中的 easy_install 安装supervisor

    easy_install supervisor

  2. 创建配置文件(两种方法都可以)

    2.1. vi /etc/supervisor.conf

    2.2. 命令 echo_supervisord_conf > /etc/supervisor.conf

  3. 修改配置文件
    3.1. 在主配置文件最后增加

    [include]
    files = /www/server/supervisor/profile/*.ini
    

    3.2. 在/www/server/supervisor/profile/路径下创建子配置文件并添加信息(守护进程)
    3.3. 创建swoole守护 vim merchant_swoole.ini

        ;监控程序名字
        [program:merchant-swoole]
        process_name=%(program_name)s_%(process_num)02d
        
        ;要用 supervisor 管理的程序指令
        command=php /data/www/crmeb_merchant/think swoole restart
        
        ;是否自动启动
        autostart=true
        
        ;是否自动重启动
        autorestart=true
        numprocs=8
        
        ;是否重定向错误
        redirect_stderr=true
        
        ;重定向到指定路径的日志文件
        stdout_logfile=/data/www/supervisor.log
    

    3.4. 创建队列守护 vim merchant_swoole.ini

        ;监控程序名字
        [program:merchant-queue]
        process_name=%(program_name)s_%(process_num)02d
        
        ;要用 supervisor 管理的程序指令
        command=php /data/www/crmeb_merchant/think queue:work  --tries=3
        
        ;是否自动启动
        autostart=true
        
        ;是否自动重启动
        autorestart=true
        numprocs=8
        
        ;是否重定向错误
        redirect_stderr=true
        
        ;重定向到指定路径的日志文件
        stdout_logfile=/data/www/supervisor.log
    
  4. 查看是否启动守护进程 ps -ef | grep think

  501 84001 83800   0  9:40上午 ttys002    0:00.70 php /Users/inuo/Code/Work/crmeb_merchant/think queue:work --tries
  501 84197 84004   0 10:04上午 ttys003    0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox think
  501 84165 84122   0 10:04上午 ttys004    0:00.12 php /Users/inuo/Code/Work/crmeb_merchant/think swoole restart
  501 84166 84165   0 10:04上午 ttys004    0:00.01 php /Users/inuo/Code/Work/crmeb_merchant/think swoole restart

这里就可以看到,已经启动了。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值