マルチホームネットワークにおける HDFS のサポート

このドキュメントは、マルチホームネットワークに HDFS をデプロイするクラスタ管理者向けです。YARN/MapReduce に対する同様のサポートは現在開発中であり、利用可能になり次第文書化されます。

マルチホーミングの背景

マルチホームネットワークでは、クラスタノードは複数のネットワークインターフェースに接続されています。これにはいくつかの理由があります。

  1. セキュリティ: セキュリティ要件により、クラスタ内トラフィックは、クラスタ内外にデータを転送するために使用されるネットワークとは異なるネットワークに制限する必要がある場合があります。

  2. パフォーマンス: クラスタ内トラフィックは、ファイバーチャネル、インフィニバンド、10GbE などの 1 つ以上の高帯域幅インターコネクトを使用する場合があります。

  3. フェイルオーバー/冗長性: ノードには、ネットワークアダプターの障害に対応するために、単一のネットワークに接続された複数のネットワークアダプターがある場合があります。

NIC ボンディング(NIC チーミングまたはリンクアグリゲーションとも呼ばれます)は、関連していますが別のトピックであることに注意してください。次の設定は通常、アプリケーションに単一の「論理ネットワーク」を提示しながら、多重化とフェイルオーバーを透過的に処理する NIC ボンディング構成には適用されません。

マルチホーム環境での Hadoop の問題を修正する

HDFS デーモンがすべてのインターフェースにバインドするようにする

デフォルトでは、HDFS エンドポイントはホスト名または IP アドレスとして指定されます。いずれの場合でも、HDFS デーモンは単一の IP アドレスにバインドするため、他のネットワークからはデーモンにアクセスできなくなります。

解決策は、ワイルドカード IP アドレス INADDR_ANY (つまり 0.0.0.0) へのバインドを強制するサーバーエンドポイント用に個別の設定を用意することです。これらの設定にはポート番号を指定しないでください。

注: マスター/スレーブ構成ファイルでは、IP アドレスよりもホスト名を使用することを推奨します。

<property>
  <name>dfs.namenode.rpc-bind-host</name>
  <value>0.0.0.0</value>
  <description>
    The actual address the RPC server will bind to. If this optional address is
    set, it overrides only the hostname portion of dfs.namenode.rpc-address.
    It can also be specified per name node or name service for HA/Federation.
    This is useful for making the name node listen on all interfaces by
    setting it to 0.0.0.0.
  </description>
</property>

<property>
  <name>dfs.namenode.servicerpc-bind-host</name>
  <value>0.0.0.0</value>
  <description>
    The actual address the service RPC server will bind to. If this optional address is
    set, it overrides only the hostname portion of dfs.namenode.servicerpc-address.
    It can also be specified per name node or name service for HA/Federation.
    This is useful for making the name node listen on all interfaces by
    setting it to 0.0.0.0.
  </description>
</property>

<property>
  <name>dfs.namenode.http-bind-host</name>
  <value>0.0.0.0</value>
  <description>
    The actual address the HTTP server will bind to. If this optional address
    is set, it overrides only the hostname portion of dfs.namenode.http-address.
    It can also be specified per name node or name service for HA/Federation.
    This is useful for making the name node HTTP server listen on all
    interfaces by setting it to 0.0.0.0.
  </description>
</property>

<property>
  <name>dfs.namenode.https-bind-host</name>
  <value>0.0.0.0</value>
  <description>
    The actual address the HTTPS server will bind to. If this optional address
    is set, it overrides only the hostname portion of dfs.namenode.https-address.
    It can also be specified per name node or name service for HA/Federation.
    This is useful for making the name node HTTPS server listen on all
    interfaces by setting it to 0.0.0.0.
  </description>
</property>

クライアントが DataNode に接続するときにホスト名を使用する

デフォルトでは、HDFS クライアントは、NameNode から提供された IP アドレスを使用して DataNode に接続します。ネットワーク構成によっては、この IP アドレスにクライアントからアクセスできない場合があります。解決策は、クライアントに DataNode ホスト名の独自の DNS 解決を実行させることです。次の設定でこの動作を有効にします。

<property>
  <name>dfs.client.use.datanode.hostname</name>
  <value>true</value>
  <description>Whether clients should use datanode hostnames when
    connecting to datanodes.
  </description>
</property>

DataNode が他の DataNode に接続するときにホスト名を使用する

まれに、DataNode の NameNode によって解決された IP アドレスが、他の DataNode からアクセスできない場合があります。解決策は、DataNode が DataNode 間接続に対して独自の DNS 解決を実行するように強制することです。次の設定でこの動作を有効にします。

<property>
  <name>dfs.datanode.use.datanode.hostname</name>
  <value>true</value>
  <description>Whether datanodes should use datanode hostnames when
    connecting to other datanodes for data transfer.
  </description>
</property>

マルチホーミングと Hadoop セキュリティ

セキュアモードの Hadoop でマルチホームホストを構成するには、追加の構成が必要になる場合があります。

ホスト名検索

Hadoop サービスの Kerberos プリンシパルは、ServiceName/_HOST@REALM.TLD (例: nn/_HOST@REALM.TLD) のパターンを使用して指定されます。これにより、すべてのホストで同じ構成ファイルを使用できます。サービスは、プリンシパルの _HOST を、実行時に検索された自身のホスト名に置き換えます。

ノードが DNS または /etc/hosts ファイルに複数のホスト名を持つように構成されている場合、サービスはサーバーが想定しているホスト名とは異なるホスト名を検索する可能性があります。例えば、2 つのサービス間のクラスタ内トラフィックはプライベートインターフェース経由でルーティングされる可能性がありますが、クライアントサービスはパブリックホスト名を検索しました。プリンシパルのホスト名がトラフィックが到着した IP アドレスと一致しないため、Kerberos 認証は失敗します。

次の設定 (Apache Hadoop 2.8.0 以降で使用可能) を使用して、サービスが検索するホスト名を制御できます。

<property>
  <name>hadoop.security.dns.interface</name>
  <description>
    The name of the Network Interface from which the service should determine
    its host name for Kerberos login. e.g. eth2. In a multi-homed environment,
    the setting can be used to affect the _HOST subsitution in the service
    Kerberos principal. If this configuration value is not set, the service
    will use its default hostname as returned by
    InetAddress.getLocalHost().getCanonicalHostName().

    Most clusters will not require this setting.
  </description>
</property>

サービスは、ホスト名検索に特定の DNS サーバーを使用するように構成することもできます (まれに必要)。

<property>
  <name>hadoop.security.dns.nameserver</name>
  <description>
    The host name or IP address of the name server (DNS) which a service Node
    should use to determine its own host name for Kerberos Login. Requires
    hadoop.security.dns.interface.

    Most clusters will not require this setting.
  </description>
</property>