jgroups udp.xml示例没有mcast

时间:2017-08-22 21:42:38

标签: jgroups

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>

1 个答案:

答案 0 :(得分:0)

有多种方法可以实现这一目标:

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