2017-03-08 50 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節點的公有地址和其他節點的公有地址。 –