9.2. Hot Rod クライアントの使用
バイナリープロトコルのマルチテナントルーティングには、SSL/TLS Server Name Indication などの標準のトランスポート層メカニズムを使用する必要があります。このサーバーは暗号化をサポートするように設定する必要があります。また、追加の SNI ルーティングを router-connector に追加する必要があります。
セキュアな Hot Rod サーバーに接続するには、クライアントは以下のような設定を使用する必要があります。
ConfigurationBuilder clientBuilder = new ConfigurationBuilder();
clientBuilder
.addServer()
.host("127.0.0.1")
.port(hotrodServer.getPort())
.security()
.ssl()
.enabled(sslClient)
.sniHostName("hotrod-1") // SNI Host Name
.trustStoreFileName("truststore.jks")
.trustStorePassword("secret".toCharArray());
remoteCacheManager = new RemoteCacheManager(clientBuilder.build());
9.2.1. マルチテナントルーター リンクのコピーリンクがクリップボードにコピーされました!
Multi-tenant ルーターエンドポイントは、1 つ以上の REST/Hot Rod コネクターのファサードとして機能します。その主な目的は、クライアントリクエストを適切なコンテナーに転送することです。
ルーティングを適切に設定するには、他のコネクターの socket-binding 属性を無効にして、以下のように追加の属性 名 を使用する必要があります。
<rest-connector name="rest-1" cache-container="local"/>
<rest-connector name="rest-2" cache-container="local"/>
<hotrod-connector name="hotrod-1" cache-container="local" />
<hotrod-connector name="hotrod-2" cache-container="local" />
次の手順では、新しい router-connector エンドポイントを追加し、他のコンテナーにアクセスする方法を設定します。Hot Rod コネクターには、TLS/SNI および REST コネクターを使用する必要があるため、URL で接頭辞を使用する必要があります。
<router-connector hotrod-socket-binding="hotrod" rest-socket-binding="rest" keep-alive="true" tcp-nodelay="false" receive-buffer-size="1024" send-buffer-size="1024">
<hotrod name="hotrod-1" >
<sni host-name="hotrod-1" security-realm="SSLRealm1"/>
</hotrod>
<hotrod name="hotrod-2" >
<sni host-name="hotrod-2" security-realm="SSLRealm2"/>
</hotrod>
<rest name="rest-1">
<prefix path="rest-1" />
</rest>
<rest name="rest-2">
<prefix path="rest-2" />
</rest>
</router-connector>
以下の設定では、SNI Host Name "hotrod-1 " を使用する場合に Hot Rod-1 コネクターにアクセスします。REST クライアントは以下の URL を使用して "rest-1" コネクター( https://<server_ip>:<server_port>/rest/rest-1 )にアクセスする必要があります。