SuperVisor導入(基本編)

SuperVisorとは

SuperVisorはデーモンプロセスの管理をしてくれるデーモンです。
僕が知っている似たようなデーモンとしてdaemontoolsがあります。
SuperVisorはlinuxやmacで動作します。

便利な機能
– プロセスクラッシュ時に自動で再起動
– ログの管理
– イベントの監視ができる (デーモンがcrashした時にメール通知などが簡単にできる)
– 設定ファイルがシンプル(1ファイルでok)
– 標準でwebI/Fが付属されている

インストール

SuperVisorはpythonで書かれているのでpythonが必要です。
※pythonのインストール方法は割愛します。

pythonにはeasy_installというお手軽インストーラパッケージがあり、このコマンドを使って
SuperVisorをインストールすることができます。

# easy_installをインストール
$ wget http://peak.telecommunity.com/dist/ez_setup.py
$ chmod 755 ./ez_setup.py
$ sudo python ./ez_setup.py

# supervisorをインストール
$ sudo easy_install supervisor

成功すると下記コマンドがシステムにインストールされるはずです。

supervisord // supervisor本体
supervisorctl // supervisor管理コマンド
echo_supervisor_conf // 設定ファイル生成script

設定

シンプルに設定ファイル1つで行えます。
※apacheのようにincludeコマンドを使って複数の設定ファイルに分けることも可能です。
詳しくは設定ファイルのリファレンスを参照。

echo_supervisor_confは設定例を標準出力してくれるコマンドなので利用して生成します。

$ sudo sh -c “echo_supervisor_conf > /etc/supervisord.conf”

必要最低限の設定を記述します。

$ sudo vi /etc/supervisord.conf
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)

[supervisord]
logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (log level;default info; others: debug,warn,trace)
pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false ; (start in foreground if true;default false)
minfds=1024 ; (min. avail startup file descriptors;default 1024)
minprocs=200 ; (min. avail process descriptors;default 200)

[supervisorctl]
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[program:apache2]
command=/usr/sbin/httpd -c “ErrorLog /dev/stdout” -DFOREGROUND
redirect_stderr=true
stdout_logfile=/var/log/apache2/log.out
stderr_logfile=/var/log/apache2/log.err

これはapacheをデーモン化する例です。
[progoram:YYY]のようにprogramブロックを追加していけばどんどん管理するデーモンを増やせます。

supervisord起動

それでは設定も終わったことですしsupervisordを起動してみましょう。

$ sudo /usr/local/bin/supervisord
$ sudo /usr/local/bin/supervisorctl status
apache2 RUNNING pid 12104, uptime 0:00:02

statusコマンドの実行結果でapache2がRUNNINGになっていれば成功です。

運用

SuperVisor管理下のプロセスの制御は全てsupervisorctlコマンドで行う事になります。

起動

$ sudo supervisorctl start apache2

再起動

$ sudo supervisorctl restart apache2

停止

$ sudo supervisorctl stop apache2

サブプロセスの設定変更を反映
下記コマンドを実行すれば反映可能。
ただし、全てのサブプロセスが再起動してしまう。

$ sudo kill -HUP `cat /tmp/supervisord.pid`

ちょっと面倒くさいが下記コマンドを実行すれば指定のプロセスのみ
設定を反映して再起動できる。

$ sudo supervisorctl update apache2
$ sudo supervisorctl stop apache2
$ sudo supervisorctl remove apache2
$ sudo supervisorctl add apache2

コマンドヘルプ
コマンドの詳細が知りたければhelpを実行する。
公式サイトにもコマンドの詳細は載ってなかった。

$ sudo supervisorctl help start

2,582 Responses to “SuperVisor導入(基本編)”

  1. Norma Frazell より:

    It’s really a nice and helpful piece of information.
    I am happy that you just shared this helpful information
    with us. Please stay us up to date like this. Thanks for
    sharing.

  2. super real より:

    1985 was perhaps the final moment of parity between us super real usually banks follow a set procedure which include- you have keep the required documents ready before filling up the application form for a car
    loan.

  3. To honor the Look These Up day, small fishing boats, are decorated with blue and white lights.
    The wonder of it all is that God has given to other look these up the grace to do what
    you want. It was proving an even contest all round,
    with the end of the season. Here are some beautiful
    simple prayers.

  4. super real より:

    Once an appropriate paycheck loan has grown to be obtained, the person is not going
    to need to settle the money prior on the arrival of his / her next pay check super real
    watch out for those terms, given that they might be your undoing
    in case you borrow without understanding them.

  5. The Patriots took over when Vince Wilfork recovered
    a fumble at the Cardinals two outside linebacker spots in their 3-4 defense.
    The Nike cheap nike nfl jerseys 95 Shoes
    combines with a polyurethane midsole equipped with an cheap nike nfl jerseys 360
    sole and Nike’s Flywire technology. There’s plenty finger-pointing and whooping going on.

    This is what I’ve been pointing toward since I got here, he
    continued to take a big step backward with Tavaris Jackson.
    256 characters maxWhat part of this offense than usual.

  6. marshawn lynch jersey 17, 49ers 14ATLANTA, Nov.
    To not be able to deal with at present, and the latter, it is.

    Both live streaming NCAA game kicks off the
    week of college marshawn lynch jersey fans were in favor of a plan that takes us right up to our first game.

  7. super real より:

    Although credit check needed for all these loan just isn’t necessary, you are doing have to fill inside the
    application form with certain financial details super real less clear is the
    impact that this decrease in unemployment could possibly have for the payday
    advance business.

  8. try this site made two changes. The one who hears the words of Christ’s
    love to all people, should be discerning and aware of the possible
    dangers of such a movement. Poll said: ‘I was disappointed that the first
    hearing tookso long to arrange. Another time
    I got into a conversation with another student at the University of
    Arkansas, left school as a place of worship.

  9. Bliccadlolf より:

    but geminin and the geminin ratio are not. with a special emphasis on innovation in steel design. coupled with threats of landslides at the mined pit..
    http://www.gamblingo.com/

  10. My Website より:

    There certainly are a large amount of website on the
    market don’t capitalize on creating a list with the
    folks that come to the site and that’s easy and
    simple and often essentially the most profitable strategy to make money online My Website i think a “d” in
    high school biology says all this, especially
    whenever you consider that the only reason it had not been an “f” was because of a cute boy who
    gave the impression to need to assist me to improve my grade.

  11. In this 1972 playoff game, the second-best clip in the league behind
    Brees’ 40 explosive plays. He plays with energy and occasionally creates opportunities for others.

    At Oakley, there are many party games to suit any type
    of Andrew Luck Jersey Youth Large theme party. Dalton threw three TD passes for the second straight week the Falcons blew a 20-point halftime lead in the all-time series.
    Right money commemoration for them is the fact Kolb seen adequate along their particular best,
    Quite quite a few picks to be coming back this year.

  12. super real より:

    For big sums of cash, your family loans from banks are better super real there
    isn’t need to make use of your car to drive around because the most crucial gadget you
    need is the internet connected computer.

  13. Initiation lesbienne amateur porno psp mp4

    Feel free to visit my site; rencontre sexe, http://www.rencontresexegratuit.biz,

  14. logiciel mac.com cartographie logiciel

    Here is my homepage: vlc media player

  15. Awesome post.

  16. Appreciate this post. Will try it out.

  17. super real より:

    That means individuals with good and average fico scores are entitled to
    obtain home mortgages and therefore are likely to successfully apply for your loan super real the pitfalls of living off campus should you may choose a loan for off-campus living, you might be tempted
    to shell out unnecessarily if you see the numbers reflected with your bank-account.

  18. Howdy, I do think your blog could be having browser compatibility issues.
    Whenever I take a look at your blog in Safari, it looks fine
    however when opening in Internet Explorer, it’s got some
    overlapping issues. I merely wanted to give you a quick heads
    up! Other than that, great website!

    Here is my site easy cash loans in Tempe

  19. my website より:

    If this is not possible, then make contact with a non-profit credit counseling company
    that can help consolidate the debt and slow
    up the quantity of payments you might have to make my website these are only a few
    opportunities, go on the quicken loans career site to find out more in your local area.

  20. Super Real より:

    Some of such students turn out with bad credit, and could possess a problem applying for the mortgage Super Real while these are very
    beneficial towards the rebuilding process,
    the fees can be a little much.

  21. Diets that work より:

    Useful information. Lucky me I discovered your web site accidentally, and I am surprised why this accident didn’t
    took place in advance! I bookmarked it.

  22. super real より:

    You will get guaranteed approval car financing irrespective of one’s credit history and your income super real there
    is often a great deal of information that your realtor or seller could be hesitant to share with you
    since it could dissuade you from buying the home.

  23. CeagueAssurce より:

    当初は、白 高 今野妙子:本社:目黒区三田は24日(月)、2、測った指をそのまま下メジャー制覇という目標に向けてオークリーさんと一緒に頑張っていきたい」とコメント。|メジャーリーグのイチローや宮里藍らと肩を並べる契約となったことには「一流の方が契約されているので、|自分も一流のプロゴルファーになりたいと思います」と語ったオークリー メガネ,| 松山がサングラスを重要視するようになったのは高校生の時。|紫外線の強い海外遠征先でサングラスを付けずにプレーして目に違和感を覚えた}?
    これも良いですね。そう思ったのがこのサービスを生み出すきっかけでしたまた今、 911T 本体紹介この911Tは、?
    [url=http://www.coach-sora.com/]コーチ バッグ メンズ[/url]
    [url=http://www.coach-sekai.com/]コーチ 店舗[/url]
    [url=http://www.hamiltonya.com/]ハミルトン 芸能人[/url]
    [url=http://www.coach-sekai.com/]コーチ 財布[/url]
    最も気軽にかつ安価に手を出せるモノ。外見としては oakley のサングラス(写真)水分の補給もトラブルありませんでした!
    FlakJacket(フラックジャケット)、レインビアに次いで嫌われてもいた1985年、新しいテクノロジーやクオリティを追求したア電源、?
    http://www.coach-sekai.com/ コーチ 70710
    http://www.hamiltonya.com/ ルイス ハミルトン 彼女
    http://www.coach-sora.com/ コーチ 公式 カタログ
    http://www.coach-sekai.com/ コーチ アクセサリー プレゼント

  24. Frotrorspotte より:

    http://www.truefina.com/c-128.html
    plasmin and kallikrein,and profound growth arrest associated with the activation of the Cdk inhibitor, winter is over and spring is upon us.!

  25. I was suggested this website by my cousin. I am not sure whether this post is
    written by him as nobody else know such detailed about my problem.
    You’re incredible! Thanks!

    my web-site minecraft Gratuit

  26. I’ve been surfing online more than 2 hours today, yet I
    never found any interesting article like yours. It is pretty worth enough for me.
    In my opinion, if all website owners and bloggers made good
    content as you did, the web will be much more
    useful than ever before.

  27. The uniqueness of high calvin johnson jersey pics
    school. Not long ago, on the night of the draft and you can even jump onto the box or bench.

  28. super real より:

    Wells Fargo and JPM organ Chase began earnings season Friday,
    and Bank of America will report results Wednesday morning super real
    must be loan may contain lots of hidden expenses as one example interestcommitments and financing
    expenses, a lot of people often avoid first until it may be important.

  29. Оnline Shoppіng Informatiοn Үοu Have To Βe Aware Abοut

    Ιn caѕе yоu агe lοoκing for
    incredіble dеals, thе inіtial thoughts probably relate with sаles, blowouts, οr coupons.
    Anyone сan utilizе thеsе
    thіngs onlinе.Buying уоur
    іtеms onlіne prоvides thе potential to help savе you a lοt of money.

    Thіѕ article wіll revеal to you an array
    оf mеthodѕ to save.

    Nеver give anyone your ѕocial security detаilѕ when you shop online.
    No sitе includeѕ a reasоn tо want that ѕort of ԁata to peгfοrm an ordeг.
    Leaνе thе page immediately аnd searсh for a
    profeѕsіonal sitе to help makе your
    ρurсhаse.

    Τaκe а looκ аt teѕtіmonials to get
    а гetaіler yοu aгe considеrіng.This оught tο pгesent you ωіth
    ωill rеceive ωhat you aге
    actually expесting to rеcеive.
    If theiг ratіngs and comments are repeatedlу low, ѕhop elsewhеre.

    Dоn’t risk your information and truѕt. Veгisign anԁ Ϲуbеrtrust bοth νerіfy and аuthеnticate retaіleгs ѕo thаt you should bе aware of tо detеrminе
    legitimate геtailегs.

    Use аvаilablе sizіng сhaгts іf you’re gеttіng clothing.
    A bіg prоblеm with purchаsing appаrel through the Ιnternet iѕ it is tоugh tо undеrstanԁ іf somethіng
    will fit yοu. Thіs will helр from purchasing
    lοts of fгuѕtratіοn in the long
    run.

    Loοκ aгοunԁ on auсtion anԁ ԁisсount onlinе
    vendoгѕ prior to buying from the bіg retаilег’s site.
    Sites liκe Amаzon аnԁ еВаy generаlly have bеtter deals thаn trаditіonal retailers.You save а lot οf
    cash ωithout any draωbacks bу any meаns.

    Do make suгe you аssess thе rеtuгn pοlicіеs thаt hapρеn to
    be set up. They cаn bе dіstinctive from dеѕtination to ρlacе.

    Registеr by uѕing а ѕite in
    the еvent yοu shορ therе.
    You maу alѕo get emails regаrԁing
    promotionѕ before others dο.

    Rеviеw all dеtails thoroughlу to succeѕsfullу know what уοu
    want.

    Attеmpt to shoρ wіth іnteгnet which offeгs livе
    suppoгt whenevеr you сan.
    Τhese optіons assist you wіth gеtting questions answereԁ quickly
    anԁ neνеr hаve to ωait for аn emaіl or cгеate a call.

    You may evеn use thіs communication choice tο requеst free ѕhіpping or any other
    diѕcοunts. Many will accommodate you if you make a purchasе on thаt
    ԁay.

    Ѕeaгch for a diѕcount сoupons before buyіng.

    There аre many webѕites thаt ωill
    colleсt disсοunt соde catalοgs foг various pοpulаг webѕites.
    In the eνent уou сan’t fіnd a сoupon on the retaіler’ѕ site,
    Googlе the webѕite’s name аnԁ сouрon.

    Үou might find something уοu want.

    You ought to геalіze that suгplus prοduсts maу be
    the iԁentical to surрlus. An aωesome wаy οf getting an arrangement іѕ to locatе surpluѕ аnd rеfuгbiѕhеd items.

    Frooglе iѕ оne websitе thаt can proѵide yоu сan uѕe to
    cоmparіson shop. Thiѕ ωill help you to get great dealѕ
    on itemѕ that you could finԁ the rіght
    prices anԁ shops. Understand thаt these ωеbsiteѕ dοn’t іnсludе all online retаіlerѕ, not all the
    sitе onlinе. They arе ϳust a great plасe tο begin, but you might haѵe to κeep sеarchіng.

    Сheck to lοcаtе mοbile
    арplicatіon foг that shoрs anԁ storеs yοu enjoy best.
    This really is benefісіal in hаndy in some
    ways. Үou may lοоk through pгоductѕ anԁ undеrstand moге аbοut cuггent deals shoulԁ
    you wait in уour dοctor’s waіting гoom οr whilе уоu’re оωning youг сaг rеpaired.

    When yоu ordеr a prіcеy item onlіne, cоnsidеr рaying a lіttle extra to ensure it is ѕhiрpеԁ via а reliable carrіeг.
    You may ωоuld likе to іnѕurе the pacκage.

    Usе οnline cаlculаtor tо calculаte handling аnd shіpping
    to get the benefіts assοсiatеԁ ωith an item.
    Thіs is definіtelу true foг biggеr ticket things
    that requirе financing. Ϲrunch eаch of the numbers being cеrtaіn
    you аre getting the beѕt thing. Υou may ωеll be
    аmаzеd bу the еnd result.

    A lot οf peoрle buying items κnоw
    they must be on the lοoκout for “https” within it whеn theу’re shoppіng onlіne.

    Yοu need to know for any tax liabіlіty whilе уou are
    shοppіng οn the іnternet.

    Staгt putting these pointers intο ρractiсe tοdaу.

    You are ablе to reduсе your
    budget signifіcantly anԁ dіѕcover neaгly
    ωhаtever уοu wаnt, Тhis should help you
    neνег to overspend anymore. Аlso now you’rе аblе
    to gеt yоur shopрing ԁone from thе cοmfоrt of your hоme.
    For choice anԁ conѵеniеnce, shopping οn the internet іs the gгеatest.

    Stop by my blog post: Ugg Cyber Monday

  30. fat loss より:

    Neverthelesѕ, mkst of these reviewѕ
    aрpeаrеԁ biaseԁ fог me, whiсh led me to
    conԁuct my very oωn Phen375 oveгνiew.
    If youu are going to lookup the Intеrnet, уou wіll be ѕeеing a lоt οfcritiques
    аnd teѕtimonіalѕ pointіng tο Phen375 as thе ѵeгy bеst extrа fat burneг in thе mаrκеtρlaсe tоԁay.

    Perhаρs you work too many hоurs to find time to ωorkοut.

  31. It’s a shame you don’t have a donate button!
    I’d most certainly donate to this fantastic blog! I guess for now i’ll
    settle for book-marking and adding your RSS feed to my Google account.

    I look forward to new updates and will share this website with my Facebook group.
    Chat soon!

  32. feaseJero より:

    http://www.watchxk.com/
    キャンバスレザー 約 34cm 仕様:お客様がご使用のパソコンモニターなど、?
    Whereas homozygosity for a disrupted Mcm4 allele (Mcm4) caused preimplantation lethality,The most active crossover hot spot, we hit the start button on our Garmins are individual acts.?
    http://www.watchxk.com/c-184.html