JGROUPS UDP.xml示例没有mcast


I am using jgroups with the default udp.xml to connect ApplicationA to Matlab.  My problem is I run Matlab/ApplicationA on multiple machines as follows:
HOST1:  running Matlab and running ApplicationA
HOST2:  running Matlab and running ApplicationA
Because of the multicast HOST1 Matlab/AppA establishes connections with HOST2 Matlab/AppA.   I want to limit Matlab and AppA to only establishing connections on the host it is running, this sounds do able with the udp.xml but I cannot get it right.   

有人可以向我展示一个udp.xml设置为不使用多播,只在运行它的主机上建立连接吗? 注意:我可以在每次运行时修改 udp.xml但希望它是通用的,并且可以在任何没有必须使用特定主机名修改 udp 的主机上工作.xml。

<!--
Default stack using IP multicasting. It is similar to the "udp"
stack in stacks.xml, but doesn't use streaming state transfer and flushing
author: Bela Ban
-->
<config xmlns="urn:org:jgroups"`enter code here`
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:org:jgroupshttp://www.jgroups.org/schema/jgroups.xsd">
<UDP
mcast_port="${jgroups.udp.mcast_port:45588}"
ip_mcast="false"
ip_ttl="0"
tos="8"
ucast_recv_buf_size="5M"
ucast_send_buf_size="5M"
mcast_recv_buf_size="5M"
mcast_send_buf_size="5M"
max_bundle_size="64K"
enable_diagnostics="true"
thread_naming_pattern="cl"
thread_pool.min_threads="0"
thread_pool.max_threads="20"
thread_pool.keep_alive_time="30000"/>
<PING />
<MERGE3 max_interval="30000"
min_interval="10000"/>
<FD_SOCK/>
<FD_ALL/>
<VERIFY_SUSPECT timeout="1500"  />
<BARRIER />
<pbcast.NAKACK2 xmit_interval="500"
xmit_table_num_rows="100"
xmit_table_msgs_per_row="2000"
xmit_table_max_compaction_time="30000"
use_mcast_xmit="false"
discard_delivered_msgs="true"/>
<UNICAST3 xmit_interval="500"
xmit_table_num_rows="100"
xmit_table_msgs_per_row="2000"
xmit_table_max_compaction_time="60000"
conn_expiry_timeout="0"/>
<pbcast.STABLE desired_avg_gossip="50000"
max_bytes="4M"/>
<pbcast.GMS print_local_addr="true" join_timeout="2000"
view_bundling="true"/>
<UFC max_credits="2M"
min_threshold="0.4"/>
<MFC max_credits="2M"
min_threshold="0.4"/>
<FRAG2 frag_size="60K"  />
<RSVP resend_interval="2000" timeout="10000"/>
<pbcast.STATE_TRANSFER />
<!-- pbcast.FLUSH  /-->
</config>

有多种方法可以实现此目的:

  • 为每个部署设置mcast_addrmcast_port不同的值,以分隔群集。您可以通过系统属性执行此操作,例如mcast_addr=${my-mcast-addr:232.1.1.1},然后使用 -Dmy-mcast-addr=x.x.x.x,这将覆盖默认值
  • UDP中将ip_ttl设置为 0。这将防止 IP 组播数据包离开本地机箱
  • 绑定到环回接口,例如通过设置(UDP(:bind_addr=loopback

最新更新