Jgroups UDP bind_addr 创建两个集群而不是一个

Jgroups UDP bind_addr creates two clusters instead one

我在同一网络中有两台服务器(10.40.20.1 和 10.40.20.2),并且 UDP 集群缓存配置如下:

使用此配置在网络中创建两个集群(每个集群有一台服务器):

  <UDP bind_addr="127.0.0.1" mcast_addr="212.1.2.1" mcast_port="49960"
                      ip_ttl="64" ip_mcast="true"   
                      mcast_send_buf_size="150000" mcast_recv_buf_size="80000"  
                      ucast_send_buf_size="150000" ucast_recv_buf_size="80000"  
                      loopback="false" /> 

这样配置比较好,用两台服务器(10.40.20.1和10.40.20.2)创建一个集群

 <UDP bind_addr="10.40.20.1" mcast_addr="212.1.2.1" mcast_port="49960"
                      ip_ttl="64" ip_mcast="true"   
                      mcast_send_buf_size="150000" mcast_recv_buf_size="80000"  
                      ucast_send_buf_size="150000" ucast_recv_buf_size="80000"  
                      loopback="false" />

我用的是jgroups 2.4.1,为什么一定要提供真实IP地址?

第一个节点绑定到 127.0.0.1,因此它不会看到另一个节点。这仅在两个节点都在同一主机上 运行 时才有效。

这就是为什么您需要将 bind_addr 设置为真正的 NIC。

您也可以将 bind_addr 设置为符号名称,例如site_local,然后将选择任何站点本地 IP 地址。

或者,您可以将其设置为正则表达式,例如bind_addr=match_interface:eth0.\* 选择以 eth0 开头的任何接口,或 bind_addr=match-address:192.168.5.\* 选择地址以 192.168.5.

开头的任何 NIC

[1] http://www.jgroups.org/manual/index.html#Transport