Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

第3章 LVS のセットアップ

LVS は二つの基本グループで構成されています: LVS router と実サーバーです。ネックとなり得る単一故障箇所を防止する為にそれぞれのグループには、少なくとも二つのメンバー システムが含まれています。
LVS router グループは、Red Hat Enterprise Linux を実行している同一の、又は近似の二つのシステムで構成 する必要があります。その1つは、アクティブ LVS router として機能し、他の 1つはホット スタンバイモードで待機し、この二つが出来る限り同様な能力を維持する必要があります。
実サーバーグループ用にハードウェアを選択して設定をする前に、3 種類の LVS トポロジーの内のどれを使用するかを決定しなければなりません。

3.1. NAT LVS ネットワーク

NAT トポロジーを使用すると、既存のハードウェアの活用に大きな自由度を得ることができますが、サーバー群を出入りするパケットがすべて LVS router を通過すると言う事実により、大量のロードを処理するには限界があります。
ネットワークレイアウト
NAT routing を使用する LVS 用のトポロジーは、公共ネットワークへ 1つのみのアクセスポイントを 必要とするだけの為、ネットワークレイアウトの観点からは最も簡単に設定ができます。実サーバーは LVS router を通じて全ての要求を渡すため、それらは自身のプライベートネットワーク内にあることになります。
ハードウェア
実サーバーは正常に機能するためには Linux マシンである必要がない為、 NAT トポロジーはハードウェアに関しては最も柔軟性を持ちます。NAT トポロジー内では、 各実サーバーは、LVS router に反応するだけのため 1つの NIC を必要とするだけです。反面、 LVS router は2つのネットワークの間でトラフィックを回送するためにそれぞれ2つの NIC を持つ必要があります。このトポロジーでは LVS router の部分でネットワークのネックとなるため、gigabit イーサネット NIC を各 LVS router で使用することにより、 LVS router が処理できるバンド幅を 拡大することができます。gigabit イーサネットが LVS router で使用される場合、実サーバーを LVS router に接続しているスイッチはロードを効率的に処理するために少なくとも2つの gigabit イーサネットが必要になります。
ソフトウェア
NAT トポロジーは、一部の設定のために iptables の使用を必要とするため、 Piranha Configuration Tool の外部でかなりのソフトウェア設定があります。特に FTP サービスとファイアウォールマークの使用は、要求を正しく回送するために余分な手動の LVS router 設定を必要とします。

3.1.1. NAT のある LVS 用の Network インターフェイス設定

To set up LVS with NAT, you must first configure the network interfaces for the public network and the private network on the LVS routers. In this example, the LVS routers' public interfaces (eth0) will be on the 192.168.26/24 network (I know, I know, this is not a routable IP, but let us pretend there is a firewall in front of the LVS router for good measure) and the private interfaces which link to the real servers (eth1) will be on the 10.11.12/24 network.
So on the active or primary LVS router node, the public interface's network script, /etc/sysconfig/network-scripts/ifcfg-eth0, could look something like this:
DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.26.9
NETMASK=255.255.255.0
GATEWAY=192.168.26.254
LVS router 上のプライベートNAT インターフェイス用の /etc/sysconfig/network-scripts/ifcfg-eth1 は次のようになります:
DEVICE=eth1
BOOTPROTO=static
ONBOOT=yes
IPADDR=10.11.12.9
NETMASK=255.255.255.0
In this example, the VIP for the LVS router's public interface will be 192.168.26.10 and the VIP for the NAT or private interface will be 10.11.12.10. So, it is essential that the real servers route requests back to the VIP for the NAT interface.

重要

The sample Ethernet interface configuration settings in this section are for the real IP addresses of an LVS router and not the floating IP addresses. To configure the public and private floating IP addresses the administrator should use the Piranha Configuration Tool, as shown in GLOBAL SETTINGS and 仮想サーバー サブセクション」.
After configuring the primary LVS router node's network interfaces, configure the backup LVS router's real network interfaces — taking care that none of the IP address conflict with any other IP addresses on the network.

重要

バックアップノード上の各インターフェイスが、主要ノード上のインターフェイスと 同じネットワークをサービスすることを確実にして下さい。例えば、eth0 が主要ノードの 公共ネットワークに接続するのであれば、それが、バックアップノードの公共ネットワークにも 接続するようにする必要があります。

3.1.2. 実サーバー上での Routing

NAT トポロジー内で実サーバーネットワークインターフェイスを設定する場合に忘れて ならないことは、LVS router の NAT 浮動 IP アドレス用にゲートウェイを設定することです。この例では、そのアドレスは 10.11.12.10 となります。

注記

Once the network interfaces are up on the real servers, the machines will be unable to ping or connect in other ways to the public network. This is normal. You will, however, be able to ping the real IP for the LVS router's private interface, in this case 10.11.12.8.
So the real server's /etc/sysconfig/network-scripts/ifcfg-eth0 file could look similar to this:
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.11.12.1
NETMASK=255.255.255.0
GATEWAY=10.11.12.10

警告

実サーバーが GATEWAY= の行で設定してある 複数のネットワークインターフェイスを持つ場合、最初に出てくる設定がゲートウェイ用となります。 そのため、eth0eth1 の両方が設定されていて eth1 が LVS に使用されている場合は、 実サーバーは要求を正しく回送しないかも知れません。
/etc/sysconfig/network-scripts/ ディレクトリ内のネットワークスクリプトで ONBOOT=no とセットするか、又は ゲートウェイが 最初に出てくるインターフェイスの中で正しくセットされるのを確認して余分なネットワークインターフェイスを オフにするのが良策です。

3.1.3. LVS Router 上の NAT Routing を有効にする

In a simple NAT LVS configuration where each clustered service uses only one port, like HTTP on port 80, the administrator needs only to enable packet forwarding on the LVS routers for the requests to be properly routed between the outside world and the real servers. See 「パケット転送をオンにする」 for instructions on turning on packet forwarding. However, more configuration is necessary when the clustered services require more than one port to go to the same real server during a user session. For information on creating multi-port services using firewall marks, see 「複数ポートサービスと LVS 」.
Once forwarding is enabled on the LVS routers and the real servers are set up and have the clustered services running, use the Piranha Configuration Tool to configure LVS as shown in 4章Piranha Configuration Tool で LVS Router を設定.

警告

Do not configure the floating IP for eth0:1 or eth1:1 by manually editing network scripts or using a network configuration tool. Instead, use the Piranha Configuration Tool as shown in GLOBAL SETTINGS and 仮想サーバー サブセクション」.
When finished, start the pulse service as shown in 「LVS の開始」. Once pulse is up and running, the active LVS router will begin routing requests to the pool of real servers.