Red Hat Training

A Red Hat training course is available for Red Hat JBoss Enterprise Application Platform

17.5.2. TCP を使用するよう JGroups サブシステムを設定

デフォルトでは、JGroups サブシステムはマルチキャスト UDP を使用して通信します。以下の手順に従って、代わりにユニキャスト TCP を使用するように JGroups サブシステムを設定します。
TCP も使用するように mod_cluster サブシステムを設定する場合は、mod_cluster サブシステムのアドバタイズの無効化」 を参照してください。
  1. お使いの環境に合わせて以下のスクリプトを変更します。

    以下のスクリプトをテキストエディターにコピーします。管理対象ドメインで別のプロファイルを使用する場合は、プロファイル名を変更します。スタンドアロンサーバーを使用する場合は、コマンドの /profile=full-ha の部分を削除します。以下のように、コマンドの下部に記載されているプロパティーを変更します。これらのプロパティーはそれぞれオプションです。
    initial_hosts
    よく知られており、最初のメンバーシップを検索するのに利用できる HOST[PORT] 構文を使用したホストのカンマ区切りのリスト。
    port_range
    必要に応じて、ポート範囲を割り当てることができます。ポート範囲を 2 に割り当て、ホストの初期ポートが 7600 である場合は、TCPPING はポート 7600-7602 のホストへの接続を試みます。ポート範囲は、initial_hosts で指定された各アドレスに適用されます。このプロパティーはオプションです。
    timeout
    クラスターメンバーの任意のタイムアウト値 (ミリ秒単位)
    num_initial_members
    クラスターが完了とみなされるまでのノード数。このプロパティーはオプションです。
    batch
    ##  If  tcp  is already added then you can remove it  ##
    /profile=full-ha/subsystem=jgroups/stack=tcp:remove
    /profile=full-ha/subsystem=jgroups/stack=tcp:add(transport={"type" =>"TCP", "socket-binding" => "jgroups-tcp"})
    /profile=full-ha/subsystem=jgroups/stack=tcp/:add-protocol(type=TCPPING)
    /profile=full-ha/subsystem=jgroups/stack=tcp/:add-protocol(type=MERGE2)
    /profile=full-ha/subsystem=jgroups/stack=tcp/:add-protocol(type=FD_SOCK,socket-binding=jgroups-tcp-fd)
    /profile=full-ha/subsystem=jgroups/stack=tcp/:add-protocol(type=FD)
    /profile=full-ha/subsystem=jgroups/stack=tcp/:add-protocol(type=VERIFY_SUSPECT)
    /profile=full-ha/subsystem=jgroups/stack=tcp/:add-protocol(type=BARRIER)
    /profile=full-ha/subsystem=jgroups/stack=tcp/:add-protocol(type=pbcast.NAKACK)
    /profile=full-ha/subsystem=jgroups/stack=tcp/:add-protocol(type=UNICAST2)
    /profile=full-ha/subsystem=jgroups/stack=tcp/:add-protocol(type=pbcast.STABLE)
    /profile=full-ha/subsystem=jgroups/stack=tcp/:add-protocol(type=pbcast.GMS)
    /profile=full-ha/subsystem=jgroups/stack=tcp/:add-protocol(type=UFC)
    /profile=full-ha/subsystem=jgroups/stack=tcp/:add-protocol(type=MFC)
    /profile=full-ha/subsystem=jgroups/stack=tcp/:add-protocol(type=FRAG2)
    /profile=full-ha/subsystem=jgroups/stack=tcp/:add-protocol(type=RSVP)
    /profile=full-ha/subsystem=jgroups:write-attribute(name=default-stack,value=tcp)
    run-batch
    /profile=full-ha/subsystem=jgroups/stack=tcp/protocol=TCPPING/property=initial_hosts/:add(value="HostA[7600],HostB[7600]")
    /profile=full-ha/subsystem=jgroups/stack=tcp/protocol=TCPPING/property=port_range/:add(value=0)
    /profile=full-ha/subsystem=jgroups/stack=tcp/protocol=TCPPING/property=timeout/:add(value=3000)
    /profile=full-ha/subsystem=jgroups/stack=tcp/protocol=TCPPING/property=num_initial_members/:add(value=3)
  2. スクリプトをバッチモードで実行します。

    警告
    バッチファイルを実行する前に、プロファイルを実行しているサーバーをシャットダウンする必要があります。
    端末エミュレーターで、jboss-cli.sh スクリプトが含まれるディレクトリーに移動し、以下のコマンドを入力します。
    ./jboss-cli.sh -c --file=SCRIPT_NAME
    SCRIPT_NAME は、スクリプトを含むパスの名前に置き換えます。

結果

TCPPING スタックが JGroups サブシステムで利用できるようになりました。これを使用すると、JGroups サブシステムはすべてのネットワーク通信に TCP を使用します。TCP も使用するように mod_cluster サブシステムを設定する場合は、mod_cluster サブシステムのアドバタイズの無効化」 を参照してください。