blob: badfbf9b21c6d551b71f8886154468ac746522c3 [file]
<!DOCTYPE html SYSTEM "about:legacy-compat">
<html lang="ja"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta content="width=device-width, initial-scale=1" name="viewport">
<!--
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This file is generated from xml source: DO NOT EDIT
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-->
<title>mod_proxy_balancer - Apache HTTP サーバ バージョン 2.5</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">
</script>
<link href="../images/favicon.png" rel="shortcut icon"></head>
<body>
<div id="page-header">
<p class="menu"><a href="../mod/">モジュール</a> | <a href="../mod/quickreference.html">ディレクティブ</a> | <a href="https://cwiki.apache.org/confluence/display/httpd/FAQ">FAQ</a> | <a href="../glossary.html">用語</a> | <a href="../sitemap.html">サイトマップ</a> | <a href="https://bz.apache.org/bugzilla/enter_bug.cgi?product=Apache%20httpd-2">Report a bug</a></p>
<p class="apache">Apache HTTP サーバ バージョン 2.5</p>
<img alt="" src="../images/feather.png"></div>
<div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif"></a></div>
<div id="path">
<a href="https://www.apache.org/">Apache</a> &gt; <a href="https://httpd.apache.org/">HTTP サーバ</a> &gt; <a href="https://httpd.apache.org/docs/">ドキュメンテーション</a> &gt; <a href="../">バージョン 2.5</a> &gt; <a href="./">モジュール</a></div>
<div id="page-content">
<div id="preamble"><h1>Apache モジュール mod_proxy_balancer</h1>
<button aria-label="Toggle language list" class="lang-toggle"><svg xmlns="http://www.w3.org/2000/svg" stroke-width="2" stroke="currentColor" fill="none" viewBox="0 0 24 24" height="16" width="16"><circle r="10" cy="12" cx="12"/><line y2="12" x2="22" y1="12" x1="2"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg></button>
<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&ccedil;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"><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>
</ul></div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif"></a></div>
<div class="section">
<h2 id="scheduler">ロードバランサのスケジューラのアルゴリズム <a title="Permanent link" href="#scheduler" class="permalink">&para;</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 id="requests">Request Counting アルゴリズム <a title="Permanent link" href="#requests" class="permalink">&para;</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 id="traffic">Weighted Traffic Counting アルゴリズム <a title="Permanent link" href="#traffic" class="permalink">&para;</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 id="enable">バランサマネージャのサポートを有効にする <a title="Permanent link" href="#enable" class="permalink">&para;</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&ccedil;ais">&nbsp;fr&nbsp;</a> |
<a href="../ja/mod/mod_proxy_balancer.html" title="Japanese">&nbsp;ja&nbsp;</a></p>
</div><div id="footer">
<p class="apache">Copyright 2026 The Apache Software Foundation.<br>この文書は <a href="https://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a> のライセンスで提供されています。.</p>
<p class="menu"><a href="../mod/">モジュール</a> | <a href="../mod/quickreference.html">ディレクティブ</a> | <a href="https://cwiki.apache.org/confluence/display/httpd/FAQ">FAQ</a> | <a href="../glossary.html">用語</a> | <a href="../sitemap.html">サイトマップ</a> | <a href="https://bz.apache.org/bugzilla/enter_bug.cgi?product=Apache%20httpd-2">Report a bug</a></p></div><script><!--//--><![CDATA[//><!--
if (typeof(prettyPrint) !== 'undefined') {
prettyPrint();
}
var langToggle = document.querySelector('.lang-toggle');
var topLang = document.querySelector('.toplang');
if (langToggle && topLang) {
langToggle.addEventListener('click', function() { topLang.classList.toggle('open'); });
}
var qv = document.getElementById('quickview');
if (qv) {
document.body.appendChild(qv);
var qvBtn = document.createElement('button');
qvBtn.className = 'qv-toggle';
qvBtn.setAttribute('aria-label', 'Toggle page navigation');
qvBtn.innerHTML = '&#9776;';
document.body.appendChild(qvBtn);
qvBtn.addEventListener('click', function() {
var isOpen = qv.classList.toggle('open');
if (isOpen) {
qv.style.top = window.scrollY + 10 + 'px';
}
});
window.addEventListener('scroll', function() { qv.classList.remove('open'); });
}
//--><!]]></script>
</body></html>