我正在尝试将FD_PING与jgroups一起使用,但它失败了。 我已经在jg-protocol-id.xml中的协议列表中添加了FD_PING,之后它已经开始识别FD_PING,但是当它在FD_PING中调用命令时,它发送节点的名称而不是要验证的ip / hostname。以下是配置。另外请告诉我,如果我可以稳定故障检测一些如何。目前我们得到了很多误报(因为我试图使用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/>
答案 0 :(得分: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。 BTW赞成使用链式协议的jgroups。