1

クライアント/サーバー トポロジのシナリオがあります。

1 つの Locator と 2 つのサーバーの単純なクラスターをローカルで実行し、異なる JVM プロセスを実行すると、次の構成で起動時にサーバーにリージョンが作成されません。

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:gfe="http://www.springframework.org/schema/gemfire"
   xmlns:util="http://www.springframework.org/schema/util"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
    http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">

<util:properties id="gemfireProperties">
    <prop key="name">${gemfire.server.name}</prop>
    <prop key="mcast-port">${gemfire.server.mcast-port}</prop>
    <prop key="log-level">${gemfire.server.log-level}</prop>
    <prop key="locators">${gemfire.server.locators}</prop>
</util:properties>

<gfe:cache properties-ref="gemfireProperties" use-cluster-configuration="true"/>

<gfe:cache-server auto-startup="true" bind-address="${gemfire.server.bind-address}"
                  host-name-for-clients="${gemfire.server.hostname-for-clients}"
                  port="${gemfire.server.port}"
                  max-connections="${gemfire.server.max-connections}"/>

次に、次の構成でクライアントを実行しています。

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:gfe="http://www.springframework.org/schema/gemfire"
   xsi:schemaLocation="http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
                        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

<beans>
    <gfe:client-cache id="gemfireClientCache" pool-name="gemfireConnectionPool" ready-for-events="true"/>

    <gfe:pool id="gemfireConnectionPool" subscription-enabled="true">
        <gfe:locator host="localhost" port="10334"/>
    </gfe:pool>

    <gfe:client-region id="MYREGION"
                       shortcut="PROXY"
                       key-constraint="java.lang.String"
                       value-constraint="MYPOJO"
                       cache-ref="gemfireClientCache"
                       pool-name="gemfireConnectionPool"/>

</beans>

Spring Boot アプリは問題なく起動しますが、次のログがおかしいことがわかります。

[info 2017/01/05 20:37:56.103 WET <main> tid=0x1] Running in local mode since mcast-port was 0 and locators was empty.

Pulse ですべてのクラスター メンバーを確認できますが、サーバーには "MYREGION" リージョンがありません。それで、キャッシュクライアントは実際にサーバー上にリージョンを作成できますか、それとも既存のリージョンのみを「使用」できますか?

Pivotal のドキュメントには「動的にリージョンを作成する」というセクションがありますが、パーティショニングが失われるため、まだその方法には行きません。

ありがとう

4

2 に答える 2

1

それで、キャッシュクライアントは実際にサーバー上にリージョンを作成できるのでしょうか、それとも既存のリージョンのみを「使用」できるのでしょうか?

OOTB、いいえ。デフォルトでは、キャッシュ クライアントは既存のRegionsのみを使用します。

ただし、GemFire 関数を使用して、GemFire クラスター内のもう 1 つの GemFire サーバーにリージョンを動的に作成することができます。これはまさにGfshが行うことです。

それでも、考慮すべきことはたくさんあります...

  1. どの「タイプ」のリージョンを作成する必要がありますか (つまり、PARTITION、REPLICATE など)。これは、クライアントのリージョンだけに基づくのは容易ではありませんか?

  2. クラスター内のどのサーバーが実際にRegionをホストする必要がありますか?

これは、クライアントがサーバー上に対応するリージョンを作成するために使用する GemFire プールによって制限できます。これは、前述のように、クライアントから関数を実行することによって行う必要があります。

(特定の) GemFire プールが特定のサーバー「グループ」で構成されている場合、その「グループ」内のクラスター内のサーバーのみがそのリージョンを作成できます。

  1. リージョンに必要なデータ ポリシーのタイプに加えて、他にも多くの構成設定と考慮事項があります (一貫性、エビクション/有効期限ポリシー、セキュリティ、トランザクション スコープ、シリアライゼーション (特に複数の言語クライアントが関与する場合... .NET を考えてください))。など) クライアントが任意にサーバーまたはサーバーのグループに任意のRegionを作成させる前に、適切に重み付けする必要があります。

これをCluster Configなどの他のものと混ぜ始めると、すぐに問題が発生する可能性があります (名前付きRegionsの競合など)。

これは開発中の便利な機能であり、SDG の新しいアノテーションベースの構成モデルについても検討していますが、SD リポジトリ抽象化によって使用される(新しい) マッピング領域アノテーションと組み合わせて、特にクライアントでアプリケーション ドメイン オブジェクト (エンティティ) に注釈を付けるために使用される新しい @ClientRegion注釈。これはおそらく運用環境ではお勧めできません。

お役に立てれば!ジョン

于 2017-01-06T06:51:20.463 に答える
1

EnableClusterConfiguration でこれを実行できます --> これを確認してください - https://docs.spring.io/spring-data/gemfire/docs/current/reference/html/#bootstrap-annotation-config

次の構成で表される電力を考慮してください。

Spring ClientCache アプリケーション

@SpringBootApplication
@ClientCacheApplication
@EnableCachingDefinedRegions
@EnableEntityDefinedRegions
@EnableIndexing
@EnableGemfireCaching
@EnableGemfireRepositories
@EnableClusterConfiguration
class ClientApplication { .. }

Pivotal GemFire ClientCache インスタンス、Spring Data Repositories、キャッシング プロバイダーとして Pivotal GemFire を使用した Spring のキャッシュ抽象化 (リージョンとインデックスはクライアントで作成されるだけでなく、クラスター内のサーバーにプッシュされます) を使用して、Spring Boot アプリケーションを即座に取得します。

于 2018-08-17T21:58:31.257 に答える