19.4.2. TCP を使用するよう JGroups サブシステムを設定
デフォルトでは、JGroups サブシステムはマルチキャスト UDP を使用して通信します。次の手順を用いて JGroups サブシステムがユニキャスト TCP を使用するように設定します。
TCP も使用するよう
mod_cluster
サブシステムを設定する場合は、「mod_cluster
サブシステムのアドバタイズの無効化」 を参照してください。
お使いの環境に合わせて以下のスクリプトを変更します。
以下のスクリプトをテキストエディターにコピーします。管理対象ドメインで異なるプロファイルを使用する場合は、プロファイル名を変更します。スタンドアロンサーバーを使用する場合は、コマンドの/profile=full-ha
部分を削除します。以下のように、コマンドの最下部にリストされたプロパティーを変更します。これらは任意のプロパティーです。- initial_hosts
- 既知と見なされたホストのカンマ区切りのリストであり、初期メンバーシップを検索するために使用できます。
- port_range
- 必要な場合は、ポート範囲を割り当てることができます。2 のポート範囲を割り当て、初期ポートが 7600 である場合は、TCPPING がポート 7600 - 7601 の各ホストと通信しようとします。これは任意のプロパティーです。
- 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)
スクリプトをバッチモードで実行します。
警告
バッチファイルを実行する前に、プロファイルを実行しているサーバーをシャットダウンする必要があります。ターミナルエミュレーターで、jboss-cli.sh
スクリプトが含まれるディレクトリーに移動し、以下のコマンドを実行します。./jboss-cli.sh -c --file=
SCRIPT_NAME はスクリプトが含まれるパスの名前に置き換えます。SCRIPT_NAME
結果
TCPPING
スタックが JGroups サブシステムで利用できるようになります。JGroups サブシステムは、すべてのネットワーク通信に TCP を使用します。mod_cluster
サブシステムが TCP も使用するよう設定するには、「mod_cluster
サブシステムのアドバタイズの無効化」 を参照してください。