【问题标题】:Infinispan Clustered Cache & JGroups - Servers don't see each otherInfinispan 集群缓存和 JGroups - 服务器看不到对方
【发布时间】:2015-01-18 00:36:13
【问题描述】:

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

我最初使用 infinispan-core-7.0.0.Final.jar 提供的预配置 JGroups 配置文件在两个本地 tomcat 实例上测试了我的 web 服务。我能够让分布式缓存在两个 Tomcat 实例之间工作,因为预配置的 xml 文件正在使用环回 IP 地址。

然后,我将 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

【问题讨论】:

    标签: spring-mvc tcp infinispan jgroups


    【解决方案1】:

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

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

    如果这没有帮助,请检查您的 UDP 防火墙和路由设置。

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

    【讨论】:

      猜你喜欢
      • 2017-11-09
      • 2014-11-21
      • 2016-06-08
      • 2018-05-25
      • 2023-03-12
      • 2012-10-30
      • 2013-12-10
      • 2014-07-26
      • 2013-01-23
      相关资源
      最近更新 更多