0

我正在尝试将 FD_PING 与 jgroups 一起使用,但它失败了。我在 jg-protocol-id.xml 的协议列表中添加了 FD_PING,之后它开始识别 FD_PING,但是当它在 FD_PING 中调用命令时,它发送节点的名称而不是要验证的 ip/主机名。以下是配置。另外请让我知道我是否可以通过某种方式稳定故障检测。目前我们收到很多误报(因为我正在尝试使用 FD_PING)。

<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">
<TCP bind_port="7800"
     loopback="true"
     recv_buf_size="${tcp.recv_buf_size:20M}"
     send_buf_size="${tcp.send_buf_size:640K}"
     discard_incompatible_packets="true"
     max_bundle_size="64K"
     max_bundle_timeout="30"
     enable_bundling="true"
     use_send_queues="true"
     sock_conn_timeout="300"

     timer_type="new"
     timer.min_threads="4"
     timer.max_threads="10"
     timer.keep_alive_time="3000"
     timer.queue_max_size="500"

     thread_pool.enabled="true"
     thread_pool.min_threads="10"
     thread_pool.max_threads="100"
     thread_pool.keep_alive_time="5000"
     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="1"
     oob_thread_pool.max_threads="8"
     oob_thread_pool.keep_alive_time="5000"
     oob_thread_pool.queue_enabled="true"
     oob_thread_pool.queue_max_size="100"
     oob_thread_pool.rejection_policy="discard"/>

<TCPPING timeout="1000"
         initial_hosts="${jgroups.tcpping.initial_hosts:localhost[7800]}"
         port_range="20"
         num_initial_members="20"/>
<MERGE2  min_interval="3000"
         max_interval="10000"/>
<FD_PING timeout="3000" max_tries="3" cmd="/tmp/test.sh"/>
<VERIFY_SUSPECT timeout="1500"  />
<BARRIER />
<SCOPE  thread_pool.min_threads="25"
        thread_pool.max_threads="100"
        thread_pool.keep_alive_time="20000"
        expiration_time="60000"/>
<pbcast.NAKACK
               use_mcast_xmit="false"
               retransmit_timeout="300,600,1200,2400,4800"
               discard_delivered_msgs="true"/>
<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/>

4

1 回答 1

0

我已经用我自己的协议封装了 FD_PING 来解决这个问题。

import org.jgroups.Address;
import org.jgroups.Event;
import org.jgroups.PhysicalAddress;
import org.jgroups.protocols.FD_PING;

public class FD_TEST extends FD_PING {

    public FD_ILABS() {
        super();
        updatePingDestination();
    }

    @Override
    public Object up(Event evt) {
        // TODO Auto-generated method stub
        Object up = super.up(evt);
        updatePingDestination();
        return up;
    }

    @Override
    public Object down(Event evt) {
        // TODO Auto-generated method stub
        Object down = super.down(evt);
        updatePingDestination();
        return down;
    }

    private void updatePingDestination() {
        if(ping_dest!=null && !(ping_dest instanceof PhysicalAddress)) {
            Address p = ping_dest;
            ping_dest = (PhysicalAddress)down_prot.down(new Event(87, p));
        }
    }





}

所有协议都是堆叠的,因此您最终可以访问 TCP。顺便说一句,jgroups 具有链式协议。

于 2012-09-20T21:54:46.723 回答