问题描述
上下文
-
Hazelcast群集中的两个节点,每个节点都位于一个离散的子网中,因此多播不适合也不适用于节点定位.
Two nodes of a Hazelcast cluster, each on a discrete subnet so multicast is not suitable nor working for node location.
我想使用最小的XML配置文件(例如hazelcast.xml
)将Hazelcast配置为使用TCP/IP连接两个节点.理想情况下,是两个节点的IP地址的目录.
I should like to employ the most minimal XML configuration file, say hazelcast.xml
, to configure Hazelcast to use TCP/IP to connect the two nodes. Ideally a directory of the IP addresses of the two nodes.
问题
Hazelcast文档很好地展示了以编程方式实现,以及hazelcast.jar/hazelcast-default.xml
如何保持(相当大的)默认配置.
The Hazelcast docs do a good job of showing how this can be achieved programatically, and how hazelcast.jar/hazelcast-default.xml
holds the (considerable) default configuration.
尚不清楚的是:我提供的任何XML配置是否覆盖在hazelcast-default.xml
中的设置上-还是仅用于其上?
What is unclear is: is any XML configuration I supply overlaid upon the settings within hazelcast-default.xml
- or simply used in its stead?
推荐答案
我有两个答案,并希望与他们分享
I have both my answers, and should like to share them
-
就像编程API一样,XML配置覆盖了
hazelcast.jar/hazelcast-default.xml
中的默认值,因此...
Just like the programatic API, the XML configuration overlays the defaults found in
hazelcast.jar/hazelcast-default.xml
, consequently ...
我可以在类路径中使用此hazelcast.xml
建立一个非常简单的两人群集
I can establish a very simple two-member cluster with this hazelcast.xml
in the classpath
<hazelcast>
<network>
<join>
<multicast enabled="false"></multicast>
<tcp-ip enabled="true">
<member>192.168.100.001</member> <!-- server A -->
<member>192.168.102.200</member> <!-- server B, on separate subnet -->
</tcp-ip>
</join>
</network>
</hazelcast>
这篇关于配置两个节点的hazelcast群集-避免多播的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!