溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

手動安裝supervisor進程守護的方法步驟

發(fā)布時間:2021-10-14 14:02:51 來源:億速云 閱讀:127 作者:iii 欄目:編程語言

本篇內(nèi)容介紹了“手動安裝supervisor進程守護的方法步驟”的有關(guān)知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!

正文開始:

  1. 安裝supervisor

    1.1.安裝python的setuptools庫

    yum install python-setuptools

    1.2.通過setuptools中的 easy_install 安裝supervisor

    easy_install supervisor

  2. 創(chuàng)建配置文件(兩種方法都可以)

    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/路徑下創(chuàng)建子配置文件并添加信息(守護進程) 3.3. 創(chuàng)建swoole守護 vim merchant_swoole.ini

        ;監(jiān)控程序名字
        [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. 創(chuàng)建隊列守護 vim merchant_swoole.ini

        ;監(jiān)控程序名字
        [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

這里就可以看到,已經(jīng)啟動了。

“手動安裝supervisor進程守護的方法步驟”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識可以關(guān)注億速云網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實用文章!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI