【问题标题】:Infinispan and JGroups discovery on EC2EC2 上的 Infinispan 和 JGroups 发现
【发布时间】:2013-07-19 00:23:01
【问题描述】:

我正在尝试在某些带有 Tomcat 服务器的 Linux 机器上使用 AWS EC2 上的应用程序。以前,我在 LAN 上将我的应用程序与 Infinispan 一起使用,并使用 UDP 多播进行 JGroups 成员发现。 EC2 不支持 UDP 多播,这是 Infinispan 用于检测集群中运行的节点的默认节点发现方法。我研究过使用 S3_PING 协议,但我还没有弄清楚为什么它不起作用。

有没有人知道这里可能存在什么问题?

这是我的配置文件: 1.applicationContext-cache.xml

<!-- Infinispan cache -->
<cache:annotation-driven/>

<import resource="classpath:/applicationContext-dao.xml"/>


<bean id="cacheManager" class="org.infinispan.spring.provider.SpringEmbeddedCacheManagerFactoryBean">
    <property name="configurationFileLocation" value="classpath:/infinispan-replication.xml"/>
</bean>

<context:component-scan base-package="com.alex.cache"/>

2.infinispan-replication.xml

<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="urn:infinispan:config:5.1 http://www.infinispan.org/schemas/infinispan-config-5.1.xsd"
        xmlns="urn:infinispan:config:5.1">

<global>
    <transport transportClass="org.infinispan.remoting.transport.jgroups.JGroupsTransport">
        <properties>
            <property name="configurationFile" value="/home/akasiyanik/dev/projects/myapp/myapp-configs/jgroups.xml"/>
        </properties>
    </transport>
</global>

<default>
    <!-- Configure a synchronous replication cache -->
    <clustering mode="replication">
        <sync/>
        <hash numOwners="2"/>
    </clustering>
</default>
</infinispan>

3。 jgroups.xml

<config>
    <TCP bind_port="${jgroups.tcp.port:7800}"
      loopback="true"
      port_range="30"
      recv_buf_size="20000000"
      send_buf_size="640000"
      discard_incompatible_packets="true"
      max_bundle_size="64000"
      max_bundle_timeout="30"        
      enable_bundling="true"
      use_send_queues="true"
      sock_conn_timeout="300"
      enable_diagnostics="false"
      thread_pool.enabled="true"
      thread_pool.min_threads="2"
      thread_pool.max_threads="30"
      thread_pool.keep_alive_time="60000"
      thread_pool.queue_enabled="false"
      thread_pool.queue_max_size="100"
      thread_pool.rejection_policy="Discard"

      oob_thread_pool.enabled="true"
      oob_thread_pool.min_threads="2"
      oob_thread_pool.max_threads="30"
      oob_thread_pool.keep_alive_time="60000"
      oob_thread_pool.queue_enabled="false"
      oob_thread_pool.queue_max_size="100"
      oob_thread_pool.rejection_policy="Discard"
     />
    <S3_PING location="r********s" access_key="AK***************SIA"
      secret_access_key="y*************************************BJ" timeout="2000" num_initial_members="2"/>
    <MERGE2 max_interval="30000"
        min_interval="10000"/>
    <FD_SOCK/>
    <FD timeout="3000" max_tries="3"/>
    <VERIFY_SUSPECT timeout="1500"/>
    <BARRIER />
    <pbcast.NAKACK use_mcast_xmit="false"
               exponential_backoff="500"
               discard_delivered_msgs="true"/>
    <UNICAST />
    <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
               max_bytes="4M"/>
    <pbcast.GMS print_local_addr="true" join_timeout="3000" 
            view_bundling="true"/>
    <UFC max_credits="2M"
     min_threshold="0.4"/>
    <MFC max_credits="2M"
     min_threshold="0.4"/>
   <FRAG2 frag_size="60K" />
   <pbcast.STATE_TRANSFER/>
</config>

【问题讨论】:

  • 真的很难说...假设您遇到的问题是节点不加入,我会在 org.jgroups 包上启用 TRACE 日志记录,看看发生了什么。配置乍一看还不错……
  • @GalderZamarreño 感谢您的建议。但我需要做的就是使用 IPv4 而不是 IPv6。为此,我使用指定的 JVM 参数来选择 IPv4:-Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses=true。
  • 那么,那行得通吗?

标签: spring amazon-s3 amazon-ec2 infinispan jgroups


【解决方案1】:

使用这个:https://github.com/meltmedia/jgroups-aws

它是使用 AWS API(多播替换)为 AWS 实现的 JGroups 发现协议

【讨论】:

    猜你喜欢
    • 2017-11-09
    • 2020-07-31
    • 2018-10-24
    • 2015-01-02
    • 2023-03-15
    • 1970-01-01
    • 2014-11-21
    • 2016-12-03
    • 2017-03-22
    相关资源
    最近更新 更多