Infinispan Clustered Cache& JGroups - 服务器看不到对方

时间:2014-11-20 08:13:29

标签: spring-mvc tcp infinispan jgroups

我使用Infinispan在两台服务器之间创建分布式缓存并利用其故障转移功能。

我最初使用infinispan-core-7.0.0.Final.jar提供的预配置JGroups配置文件在两个本地tomcat实例上测试了我的webservice。由于预先配置的xml文件使用了环回IP地址,因此我能够在两个Tomcat实例之间运行分布式缓存。

然后我将Web服务移动到两个单独的服务器上,并且无法让它们加入同一个组。我创建了自己的自定义JGroups tcp配置xml,因为在预先配置的环境中使用环回ip导致了一些问题。

我在设置tcp或udp频道方面没有多少经验,所以我认为问题可能在于我的JGroups配置文件(我将其基于预先配置的文件)。

<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.4.xsd">
        <!-- bind_addr="${jgroups.tcp.address:127.0.0.1}"-->
   <TCP
        bind_addr="GLOBAL"
        bind_port="${jgroups.tcp.port:7800}"
        port_range="30"
        recv_buf_size="20m"
        send_buf_size="640k"
        max_bundle_size="31k"
        use_send_queues="true"
        enable_diagnostics="false"
        bundler_type="sender-sends-with-timer"

        thread_naming_pattern="pl"

        thread_pool.enabled="true"
        thread_pool.min_threads="2"
        thread_pool.max_threads="30"
        thread_pool.keep_alive_time="60000"
        thread_pool.queue_enabled="true"
        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"

        internal_thread_pool.enabled="true"
        internal_thread_pool.min_threads="2"
        internal_thread_pool.max_threads="4"
        internal_thread_pool.keep_alive_time="60000"
        internal_thread_pool.queue_enabled="true"
        internal_thread_pool.queue_max_size="100"
        internal_thread_pool.rejection_policy="Discard"
        />

   <!-- Ergonomics, new in JGroups 2.11, are disabled by default in TCPPING until JGRP-1253 is resolved -->
   <!--
   <TCPPING timeout="3000"
            initial_hosts="localhost[7800],localhost[7801]"
            port_range="5"
            num_initial_members="3"
            ergonomics="false"
        />
   -->

   <!-- bind_addr="${jgroups.bind_addr:127.0.0.1}" -->
 <!--  ip_ttl="${jgroups.udp.ip_ttl:2}"-->
   <MPING bind_addr="GLOBAL" break_on_coord_rsp="true"
      mcast_addr="${jgroups.mping.mcast_addr:228.2.4.6}"
      mcast_port="${jgroups.mping.mcast_port:43366}"
      num_initial_members="3"/>
   <MERGE3/>

   <FD_SOCK/>
   <FD timeout="3000" max_tries="5"/>
   <VERIFY_SUSPECT timeout="1500"/>

   <pbcast.NAKACK2 use_mcast_xmit="false"
                   xmit_interval="1000"
                   xmit_table_num_rows="100"
                   xmit_table_msgs_per_row="10000"
                   xmit_table_max_compaction_time="10000"
                   max_msg_batch_size="100"/>
   <UNICAST3 xmit_interval="500"
             xmit_table_num_rows="20"
             xmit_table_msgs_per_row="10000"
             xmit_table_max_compaction_time="10000"
             max_msg_batch_size="100"
             conn_expiry_timeout="0"/>

   <pbcast.STABLE stability_delay="500" desired_avg_gossip="5000" max_bytes="1m"/>
   <pbcast.GMS print_local_addr="false" join_timeout="3000" view_bundling="true"/>
   <tom.TOA/> <!-- the TOA is only needed for total order transactions-->

   <MFC max_credits="2m" min_threshold="0.40"/>
   <FRAG2 frag_size="30k"/>
   <RSVP timeout="60000" resend_interval="500" ack_on_delivery="false" />
</config>

我最初的想法是问题可能出在TCP和MPing元素中的bind_addr。这两台服务器位于同一网络上,可以互相ping通。任何人对上面的配置文件有任何提示/见解?

如果有帮助我已经在日志文件中发布了以下Infinispan / JGroups创业公司的内容:

服务器1:

INFO  JGroupsTransport - ISPN000078: Starting JGroups channel esrs
Nov 20, 2014 3:22:43 AM org.jgroups.logging.JDKLogImpl warn
WARNING: JGRP000014: Discovery.num_initial_members has been deprecated: will be ignored
INFO  JGroupsTransport - ISPN000094: Received new cluster view for channel esrs: [udmesrs02-61057|0] (1) [udmesrs02-61057]
INFO  JGroupsTransport - ISPN000079: Channel esrs local address is udmesrs02-61057
INFO  GlobalComponentRegistry - ISPN000128: Infinispan version: Infinispan 'Guinness' 7.0.0.Final

服务器2:

INFO  JGroupsTransport - ISPN000078: Starting JGroups channel esrs
Nov 20, 2014 3:20:28 AM org.jgroups.logging.JDKLogImpl warn
WARNING: JGRP000014: Discovery.num_initial_members has been deprecated: will be ignored
INFO  JGroupsTransport - ISPN000094: Received new cluster view for channel esrs: [udmesrs01-16389|0] (1) [udmesrs01-16389]
INFO  JGroupsTransport - ISPN000079: Channel esrs local address is udmesrs01-16389
INFO  GlobalComponentRegistry - ISPN000128: Infinispan version: Infinispan 'Guinness' 7.0.0.Final

1 个答案:

答案 0 :(得分:0)

有两个可能的问题:IPv4 / IPv6问题和UDP路由。

首先尝试在两台计算机上设置-Djava.net.preferIPv4Stack=true

如果这样做无效,请检查您的UDP防火墙和路由设置。

如果你在那里找不到任何奇怪的东西,你将不得不在udp和端口43366和tcp 7800上使用tcpdump并查看是否有任何活动 - 每个节点应至少每15秒发送一些多播数据包