手动安装supervisor进程守护的方法步骤

发布时间:2021-10-14 14:02:51 作者:iii
来源:亿速云 阅读:115

本篇内容介绍了“手动安装supervisor进程守护的方法步骤”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

正文开始:

  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

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

“手动安装supervisor进程守护的方法步骤”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!

推荐阅读:
  1. 编写守护进程
  2. 安装supervisor

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

supervisor python

上一篇:如何实现点击Button按钮时将数据插入数据库中

下一篇:ADO.Net类型化DataSet有什么用

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》