2017-03-08 87 views
0

我已经成功地通过不同的机器使用TCP在本地网络上工作的JGroups,我无法使用多播。我需要两个节点通过互联网进行通信的能力。将地址更改为公共地址似乎不起作用,并且需要额外的配置。 我看过http://www.jgroups.org/manual-3.x/html/protlist.html 并设置external_addr,但也许有更多的设置。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-4.0.xsd"> 

<TCP bind_port="7800" 
    recv_buf_size="${tcp.recv_buf_size:130k}" 
    send_buf_size="${tcp.send_buf_size:130k}" 
    max_bundle_size="64K" 
    sock_conn_timeout="300" 
client_bind_addr="GLOBAL" 
    thread_pool.min_threads="0" 
    thread_pool.max_threads="20" 
    thread_pool.keep_alive_time="30000"/> 

<TCPPING async_discovery="true" 
     initial_hosts="${jgroups.tcpping.initial_hosts:52.211.80.63[7801]}" 
     port_range="2"/> 
<MERGE3 min_interval="10000" 
     max_interval="30000"/> 
<FD_SOCK/> 
<FD timeout="3000" max_tries="3" /> 
<VERIFY_SUSPECT timeout="1500" /> 
<BARRIER /> 
<pbcast.NAKACK2 use_mcast_xmit="false" 
       discard_delivered_msgs="true"/> 
<UNICAST3 /> 
<pbcast.STABLE desired_avg_gossip="50000" 
       max_bytes="4M"/> 
<pbcast.GMS print_local_addr="true" join_timeout="2000" 
      view_bundling="true"/> 
<MFC max_credits="2M" 
    min_threshold="0.4"/> 
<FRAG2 frag_size="60K" /> 
<!--RSVP resend_interval="2000" timeout="10000"/--> 
<pbcast.STATE_TRANSFER/> 

</config> 

回答

0

不,你不会需要external_addr,除非你是一个NAT后面。你需要做的是:

  • 设置TCP.bind_addr(我建议删除TCP.client_bind_addr),例如,给公众一个IP地址(50.x.x.x
  • TCPPING.initial_hosts需要有成员的地址的所有(或大部分)

您当前的配置无法正常使用,因为:(1)bind_addr是不确定的和( 2)initial_hosts列出端口7801成员,但TCP.bind_port7800

+0

我在NAT后面,在我的测试设置中,我有一个AWS(NAT)ed节点和一个外部(非NAT)节点。这与你所建议的有很大的不同吗?谢谢。 –

+0

是的,对于NAT后面的节点,将'bind_addr'设置为internal,'external_addr'设置为公共IP地址。在'TCPPING.initial_hosts'中,包含natted节点的公有地址和其他节点的公有地址。 –