Search code examples
gemfirespring-data-gemfire

Gemfire WAN Gateway-sender configuration


We are using the Gemfire WAN topology and have problems setting up the gateway-senders.

Couple of assumptions: - Replicated regions - Serial gateway-senders - manual-start is false for all gateway-senders

Let's say we have 2 clusters, within each cluster, we have 2 members (Member A and Member B)

Member A's cache.xml

<gfe:gateway-sender id="gateway-sender-A" parallel="false" remote-distributed-system-id="2" manual-start="false" /> 
<gfe:replicated-region name="data" scope="DISTRIBUTED_NO_ACK"> 
<gfe:replicated-region name="subData" data-policy="REPLICATE" scope="DISTRIBUTED_ACK"> 
<gfe:gateway-sender-ref bean="gateway-sender-A"/> 
</gfe:replicated-region> 
</gfe:replicated-region> 

Member B's cache.xml

<gfe:gateway-sender id="gateway-sender-B" parallel="false" remote-distributed-system-id="2" manual-start="false" /> 
<gfe:replicated-region name="data" scope="DISTRIBUTED_NO_ACK"> 
<gfe:replicated-region name="subData" data-policy="REPLICATE" scope="DISTRIBUTED_ACK"> 
<gfe:gateway-sender-ref bean="gateway-sender-B"/> 
</gfe:replicated-region> 
</gfe:replicated-region>

There is a problem when we run start up the two members within one cluster. It raises this error:

java.lang.IllegalStateException: Cannot create Region /data with [gateway-sender-A] gateway sender ids because another cache has the same region defined with [gateway-sender-B] gateway sender ids

Looking at the "High Availability for Gateway Senders" documentation, our understanding is that we can create 2 gateway-senders, in which only one will be doing the sending at a given point in time. Ultimately, we want to have 2 gateway senders (one in each member) for one cache region, one as the primary sender and the other as the secondary sender.

Thanks


Solution

  • After changing the sender-ids to the same for both members, we have another problem:

    java.lang.IllegalStateException: Cannot create Gateway Sender "some-gateway-sender-id" with manual start "false" because another cache has the same Gateway Sender defined with manual start "true

    It seems like our problem was the inconsistent format.

    Member A used XML format

    <?xml version="1.0"?> <!DOCTYPE cache PUBLIC "-//GemStone Systems, Inc.//GemFire Declarative Caching 8.0//EN" "http://www.gemstone.com/dtd/cache8_0.dtd">

    Member B used Spring Gemfire Data format

    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"> <gfe:gateway-sender ...>

    We switched to using the Spring Gemfire Data format for both members, and it solved both issues.

    TL;DR, the gateway-senders need to have the same ids if they are in the same cluster and use consistent cache xml formats.