mod_proxy_balancer.html.ja.utf8 18.8 KB
Newer Older
powelld's avatar
powelld committed
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja"><head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<!--
        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
              This file is generated from xml source: DO NOT EDIT
        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
      -->
<title>mod_proxy_balancer - Apache HTTP サーバ バージョン 2.4</title>
<link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
<link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
<link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="../style/css/prettify.css" />
<script src="../style/scripts/prettify.min.js" type="text/javascript">
</script>

<link href="../images/favicon.ico" rel="shortcut icon" /></head>
<body>
<div id="page-header">
<p class="menu"><a href="../mod/">モジュール</a> | <a href="../mod/directives.html">ディレクティブ</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">用語</a> | <a href="../sitemap.html">サイトマップ</a></p>
<p class="apache">Apache HTTP サーバ バージョン 2.4</p>
<img alt="" src="../images/feather.png" /></div>
<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
<div id="path">
<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP サーバ</a> &gt; <a href="http://httpd.apache.org/docs/">ドキュメンテーション</a> &gt; <a href="../">バージョン 2.4</a> &gt; <a href="./">モジュール</a></div>
<div id="page-content">
<div id="preamble"><h1>Apache モジュール mod_proxy_balancer</h1>
<div class="toplang">
<p><span>翻訳済み言語: </span><a href="../en/mod/mod_proxy_balancer.html" hreflang="en" rel="alternate" title="English">&nbsp;en&nbsp;</a> |
<a href="../fr/mod/mod_proxy_balancer.html" hreflang="fr" rel="alternate" title="Français">&nbsp;fr&nbsp;</a> |
<a href="../ja/mod/mod_proxy_balancer.html" title="Japanese">&nbsp;ja&nbsp;</a></p>
</div>
<div class="outofdate">この日本語訳はすでに古くなっている
            可能性があります。
            最近更新された内容を見るには英語版をご覧下さい。
        </div>
<table class="module"><tr><th><a href="module-dict.html#Description">説明:</a></th><td>負荷分散のための <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> 拡張</td></tr>
<tr><th><a href="module-dict.html#Status">ステータス:</a></th><td>Extension</td></tr>
<tr><th><a href="module-dict.html#ModuleIdentifier">モジュール識別子:</a></th><td>proxy_balancer_module</td></tr>
<tr><th><a href="module-dict.html#SourceFile">ソースファイル:</a></th><td>mod_proxy_balancer.c</td></tr>
<tr><th><a href="module-dict.html#Compatibility">互換性:</a></th><td>2.1 以降</td></tr></table>
<h3>概要</h3>

    <p>本モジュールには <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code><em>必要です</em>
    <code>HTTP</code>, <code>FTP</code><code>AJP13</code>
    プロトコルのロードバランス機能を持っています。</p>

    <p>ですから、 ロードバランスを有効にする場合 <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code>
<code class="module"><a href="../mod/mod_proxy_balancer.html">mod_proxy_balancer</a></code> がサーバに組み込まれて
    いなければいけません。</p>

    <div class="warning"><h3>警告</h3>
      <p><a href="mod_proxy.html#access">安全なサーバにする</a>までプロクシ機能は有効にしないでください。
      オープンプロキシサーバはあなた自身のネットワークにとっても、
      インターネット全体にとっても危険です。</p>
    </div>
</div>
<div id="quickview"><a href="https://www.apache.org/foundation/contributing.html" class="badge"><img src="https://www.apache.org/images/SupportApache-small.png" alt="Support Apache!" /></a><h3>トピック</h3>
<ul id="topics">
<li><img alt="" src="../images/down.gif" /> <a href="#scheduler">ロードバランサのスケジューラのアルゴリズム</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#requests">Request Counting アルゴリズム</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#traffic">Weighted Traffic Counting アルゴリズム</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#enable">バランサマネージャのサポートを有効にする</a></li>
</ul><h3 class="directives">ディレクティブ</h3>
<p>このモジュールにディレクティブはありません。</p>
<h3>Bugfix checklist</h3><ul class="seealso"><li><a href="https://www.apache.org/dist/httpd/CHANGES_2.4">httpd changelog</a></li><li><a href="https://bz.apache.org/bugzilla/buglist.cgi?bug_status=__open__&amp;list_id=144532&amp;product=Apache%20httpd-2&amp;query_format=specific&amp;order=changeddate%20DESC%2Cpriority%2Cbug_severity&amp;component=mod_proxy_balancer">Known issues</a></li><li><a href="https://bz.apache.org/bugzilla/enter_bug.cgi?product=Apache%20httpd-2&amp;component=mod_proxy_balancer">Report a bug</a></li></ul><h3>参照</h3>
<ul class="seealso">
<li><code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code></li>
<li><a href="#comments_section">コメント</a></li></ul></div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="scheduler" id="scheduler">ロードバランサのスケジューラのアルゴリズム</a></h2>
    
    <p>現時点では 2 種類のロードバランサスケジューラアルゴリズムから選べます。
    リクエスト回数によるもの <span class="transnote">(<em>訳注:</em> Request Counting)</span>
    と、トラフィック量によるもの <span class="transnote">(<em>訳注:</em> Weighted Traffic Counting)</span>
    があります。バランサの設定 <code>lbmethod</code> 値で、どちらを使うか指定します。
    詳細は <code class="directive"><a href="../mod/mod_proxy.html#proxy">Proxy</a></code> ディレクティブを
    参照してください。</p>

</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="requests" id="requests">Request Counting アルゴリズム</a></h2>
    
    <p><code>lbmethod=byrequests</code> で有効になります。
    このスケジューラの背景にある考え方は、様々なワーカーがそれぞれ、
    設定されている分担リクエスト数をきちんと受け取れるように、
    リクエストを扱うという考え方です。次のように動作します:</p>

    <p><dfn>lbfactor</dfn> は、<em>どの程度ワーカーに仕事を振るか</em>
    つまり<em>ワーカーのクオータ</em>を指します。この値は "分担" 
    量を表す正規化された値です。</p>

    <p><dfn>lbstatus</dfn> は、<em>ワーカーのクオータを満たすために
    どのぐらい急ぎで働かなければならないか</em>を指します。</p>

    <p><dfn>ワーカー</dfn>はロードバランサのメンバで、通常は、
    サポートされるプロトコルのうちの一つを提供しているリモートホストです。
    </p>

    <p>まず個々のワーカーにワーカークオータを割り振り、どのワーカーが最も急ぎで
    働かなければならないか (lbstatus が最大のもの) を調べます。
    次に仕事をするようにこのワーカーを選択し、選択したワーカーの lbstatus 
    を全体に割り振ったぶんだけ差し引きます。ですから、lbstatus の総量は
    結果的に変化しません(*)し、リクエストは期待通りに分散されます。</p>

    <p>あるワーカーが無効になっても、他のものは正常にスケジュールされ続けます。
    </p>

    <div class="example"><pre><code>for each worker in workers
    worker lbstatus += worker lbfactor
    total factor    += worker lbfactor
    if worker lbstatus &gt; candidate lbstatus
        candidate = worker

candidate lbstatus -= total factor</code></pre></div>

    <p>バランサを次のように設定した場合:</p>
    
    <table><tr><th>worker</th>
        <th class="data">a</th>
        <th class="data">b</th>
        <th class="data">c</th>
        <th class="data">d</th></tr>
<tr><th>lbfactor</th>
        <td class="data">25</td>
        <td class="data">25</td>
        <td class="data">25</td>
        <td class="data">25</td></tr>
<tr><th>lbstatus</th>
        <td class="data">0</td>
        <td class="data">0</td>
        <td class="data">0</td>
        <td class="data">0</td></tr>
</table>

    <p>そして <var>b</var> が無効になった場合、次のようなスケジュールが
    行われます。</p>

    <table><tr><th>worker</th>
        <th class="data">a</th>
        <th class="data">b</th>
        <th class="data">c</th>
        <th class="data">d</th></tr>
<tr><th>lbstatus</th>
        <td class="data"><em>-50</em></td>
        <td class="data">0</td>
        <td class="data">25</td>
        <td class="data">25</td></tr>
<tr><th>lbstatus</th>
        <td class="data">-25</td>
        <td class="data">0</td>
        <td class="data"><em>-25</em></td>
        <td class="data">50</td></tr>
<tr><th>lbstatus</th>
        <td class="data">0</td>
        <td class="data">0</td>
        <td class="data">0</td>
        <td class="data"><em>0</em></td></tr>
<tr><td class="data" colspan="5">(repeat)</td></tr>
</table>

    <p>つまりこのようにスケジュールされます: <var>a</var> <var>c</var>
    <var>d</var> <var>a</var> <var>c</var> <var>d</var> <var>a</var>
    <var>c</var> <var>d</var> ... 次の点に注意してください:</p>

    <table><tr><th>worker</th>
        <th class="data">a</th>
        <th class="data">b</th>
        <th class="data">c</th>
        <th class="data">d</th></tr>
<tr><th>lbfactor</th>
        <td class="data">25</td>
        <td class="data">25</td>
        <td class="data">25</td>
        <td class="data">25</td></tr>
</table>

    <p>この挙動は、次の設定と全く同じになります:</p>

    <table><tr><th>worker</th>
        <th class="data">a</th>
        <th class="data">b</th>
        <th class="data">c</th>
        <th class="data">d</th></tr>
<tr><th>lbfactor</th>
        <td class="data">1</td>
        <td class="data">1</td>
        <td class="data">1</td>
        <td class="data">1</td></tr>
</table>

    <p>This is because all values of <dfn>lbfactor</dfn> are normalized
    with respect to the others. For:</p>
    <p><dfn>lbfactor</dfn> は全て正規化されたもので、
    他との相対値だからです。次の設定では:</p>

    <table><tr><th>worker</th>
        <th class="data">a</th>
        <th class="data">b</th>
        <th class="data">c</th></tr>
<tr><th>lbfactor</th>
        <td class="data">1</td>
        <td class="data">4</td>
        <td class="data">1</td></tr>
</table>

    <p>ワーカー <var>b</var> は、平均して、<var>a</var><var>c</var>
    の 4 倍の数のリクエストを受け持つことになります。</p>

    <p>次のような非対称な設定では、こうなると予想されるでしょう:</p>

    <table><tr><th>worker</th>
        <th class="data">a</th>
        <th class="data">b</th></tr>
<tr><th>lbfactor</th>
        <td class="data">70</td>
        <td class="data">30</td></tr>
<tr><td class="data" colspan="2">&nbsp;</td></tr>
<tr><th>lbstatus</th>
        <td class="data"><em>-30</em></td>
        <td class="data">30</td></tr>
<tr><th>lbstatus</th>
        <td class="data">40</td>
        <td class="data"><em>-40</em></td></tr>
<tr><th>lbstatus</th>
        <td class="data"><em>10</em></td>
        <td class="data">-10</td></tr>
<tr><th>lbstatus</th>
        <td class="data"><em>-20</em></td>
        <td class="data">20</td></tr>
<tr><th>lbstatus</th>
        <td class="data"><em>-50</em></td>
        <td class="data">50</td></tr>
<tr><th>lbstatus</th>
        <td class="data">20</td>
        <td class="data"><em>-20</em></td></tr>
<tr><th>lbstatus</th>
        <td class="data"><em>-10</em></td>
        <td class="data">10</td></tr>
<tr><th>lbstatus</th>
        <td class="data"><em>-40</em></td>
        <td class="data">40</td></tr>
<tr><th>lbstatus</th>
        <td class="data">30</td>
        <td class="data"><em>-30</em></td></tr>
<tr><th>lbstatus</th>
        <td class="data"><em>0</em></td>
        <td class="data">0</td></tr>
<tr><td class="data" colspan="3">(repeat)</td></tr>
</table>

    <p>スケジュールは 10 スケジュール後に繰り返され、<var>a</var> 7 回と
    <var>b</var> 3 回でまばらに選ばれます。</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="traffic" id="traffic">Weighted Traffic Counting アルゴリズム</a></h2>
    
    <p><code>lbmethod=bytraffic</code> で有効になります。
    このスケジューラの背景にある考え方は、Request Counting 
    と非常に似ていますが、次の違いがあります:</p>

    <p><dfn>lbfactor</dfn><em>どれだけのバイト数のトラフィック量を、
    このワーカーに処理してもらいたいか</em> を表します。
    この値も同様に正規化された値で、ワーカー全体のうちでの "分担"
    量を表現しています。リクエスト数を単純に数える代わりに、
    どれだけの転送量を処理したかを数えます。</p>

    <p>次のようにバランサを設定した場合:</p>
    
    <table><tr><th>worker</th>
        <th class="data">a</th>
        <th class="data">b</th>
        <th class="data">c</th></tr>
<tr><th>lbfactor</th>
        <td class="data">1</td>
        <td class="data">2</td>
        <td class="data">1</td></tr>
</table>

    <p><var>b</var> には <var>a</var><var>c</var> の 2 倍
    処理してほしいということになります。
    <var>b</var> は 2 倍の I/O を処理するという意味になり、
    2 倍のリクエスト数を処理するということにはなりません。
    ですからリクエストとレスポンスのサイズが、
    重み付けと振り分けのアルゴリズムに効いています。</p>

</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="enable" id="enable">バランサマネージャのサポートを有効にする</a></h2>
    
    <p>このモジュールは <code class="module"><a href="../mod/mod_status.html">mod_status</a></code> のサービスを
    <em>必要とします</em>
    バランサマネージャを使うと、バランサのメンバーの動的な更新が
    できます。バランサマネージャを使って、バランス係数 (lbfactor)
    を変更したり、メンバーを変更したり、特定のメンバーを
    オフラインモードにしたりできます。</p>

    <p>ですから、ロードバランサ管理機能を使いたければ、
    <code class="module"><a href="../mod/mod_status.html">mod_status</a></code><code class="module"><a href="../mod/mod_proxy_balancer.html">mod_proxy_balancer</a></code>
    をサーバに組み込まなければなりません。</p>

    <p>foo.com ドメインのブラウザからロードバランサ管理機能を
    使えるようにするには、次のようなコードを <code>httpd.conf</code>
    に追加します。</p>
<div class="example"><p><code>
    &lt;Location /balancer-manager&gt;<br />
    SetHandler balancer-manager<br />
<br />
    Order Deny,Allow<br />
    Deny from all<br />
    Allow from .foo.com<br />
    &lt;/Location&gt;
</code></p></div>

    <p>こうすると、<code>http://your.server.name/balancer-manager</code>
    のページ経由で、ウェブブラウザからロードバランサマネージャに
    アクセスできるようになります。</p>
</div>
</div>
<div class="bottomlang">
<p><span>翻訳済み言語: </span><a href="../en/mod/mod_proxy_balancer.html" hreflang="en" rel="alternate" title="English">&nbsp;en&nbsp;</a> |
<a href="../fr/mod/mod_proxy_balancer.html" hreflang="fr" rel="alternate" title="Français">&nbsp;fr&nbsp;</a> |
<a href="../ja/mod/mod_proxy_balancer.html" title="Japanese">&nbsp;ja&nbsp;</a></p>
</div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">コメント</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&amp;A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
<script type="text/javascript"><!--//--><![CDATA[//><!--
var comments_shortname = 'httpd';
var comments_identifier = 'http://httpd.apache.org/docs/2.4/mod/mod_proxy_balancer.html';
(function(w, d) {
    if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
        d.write('<div id="comments_thread"><\/div>');
        var s = d.createElement('script');
        s.type = 'text/javascript';
        s.async = true;
        s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
        (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
    }
    else { 
        d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
    }
})(window, document);
//--><!]]></script></div><div id="footer">
<p class="apache">Copyright 2017 The Apache Software Foundation.<br />この文書は <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a> のライセンスで提供されています。.</p>
<p class="menu"><a href="../mod/">モジュール</a> | <a href="../mod/directives.html">ディレクティブ</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">用語</a> | <a href="../sitemap.html">サイトマップ</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
if (typeof(prettyPrint) !== 'undefined') {
    prettyPrint();
}
//--><!]]></script>
</body></html>