簡體   English   中英

使用TCP的Ehcache Jgroups復制在具有2個節點集群的AWS雲中不起作用

[英]Ehcache Jgroups replication using TCP not working in AWS cloud with 2 node cluster

以下是我們正在使用的ehcache配置。 我們使用Jgroups進行緩存復制。

ehcache.xml

<defaultCache
        maxElementsInMemory="10000"
        eternal="false"
        timeToIdleSeconds="1200"
        timeToLiveSeconds="86400"
        overflowToDisk="true"
        diskSpoolBufferSizeMB="30"
        maxElementsOnDisk="10000000"
        diskPersistent="false"
        diskExpiryThreadIntervalSeconds="120"
        memoryStoreEvictionPolicy="LRU">
    <cacheEventListenerFactory
            class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
            properties="replicateAsynchronously=true,replicatePuts=true,replicateUpdates=true,replicateUpdatesViaCopy=true,replicateRemovals=true" />
</defaultCache>

jgroups_tcp_config.xml

<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="urn:org:jgroups"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/JGroups-3.0.xsd">
   <!--Configure node ip inside bind_addr-->
   <TCP bind_addr="host1" bind_port="7831" max_bundle_size="9999999"/>
   <!--Configure nodes inside 'initial_hosts' property-->
   <TCPPING timeout="3000" initial_hosts="host1[7831],host2[7831]" port_range="1" num_initial_members="3"/>
   <FRAG2 frag_size="9999999"/>
   <MERGE3 max_interval="30000" min_interval="10000"/>
   <FD timeout="3000" max_tries="10"/>
   <VERIFY_SUSPECT timeout="1500"/>
   <pbcast.NAKACK use_mcast_xmit="false" exponential_backoff="500" discard_delivered_msgs="false"/>
   <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000" max_bytes="400000"/>
   <pbcast.GMS print_local_addr="true" join_timeout="5000" view_bundling="true"/>
</config>

最初,從日志中我們可以看到節點正在群集。 我們還可以看到消息正在跨節點復制。 但是一段時間后,我們看到消息不再被復制,從而導致錯誤的行為。 我們使用的jgroups配置是否有問題?

另外,我們嘗試使用NAKACK2,但是消息根本不會在節點之間復制。 在上述指定的配置中,我們僅用NAKACK2替換了NAKACK。 不知道我們要去哪里錯。

上面的問題我們在AWS雲中面臨.Ehcache Jgroups tcp在雲環境中不起作用,因為由於不會發生節點發現而導致Cloud VPN不支持TCP多播,為了解決這個問題,我們使用jgroups_s3_config.xml而不是jgroups_tcp_config.xml在AWS雲中。使用以下jgroups_s3_config.xml配置,我們已解決了該問題。

<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="urn:org:jgroups"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/JGroups-3.1.xsd">
    <TCP loopback="true" bind_port="7800"/>
    <S3_PING location="s3 bucket name should be in the same region in which app servers are running" 
    access_key="s3 bucket access key from aws credential file" 
    secret_access_key="s3 bucket secret access key from aws credential file" timeout="10000" num_initial_members="2"/>
    <FRAG2/>
    <MERGE2 min_interval="10000" max_interval="30000"/>
    <FD_ALL timeout="12000" interval="3000" timeout_check_interval="4000"/>
    <VERIFY_SUSPECT timeout="1500"/>
    <pbcast.NAKACK2 use_mcast_xmit="false" discard_delivered_msgs="false"/>
    <UNICAST2 timeout="300,600,1200"/>
    <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000" max_bytes="40K"/>
    <pbcast.GMS print_local_addr="true" join_timeout="5000" view_bundling="true"/>
</config>

另外,我們必須設置JAVA_OPTS。

  export JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM