gpt4 book ai didi

java - 使用 HazelCast 进行水平聚类

转载 作者:行者123 更新时间:2023-12-01 14:06:25 34 4
gpt4 key购买 nike

    I am using hazelCast-3.0 jars . I am able to create vertical cluster(on the same System where only port no. differ from one server to other Ip remains the same.) and its working  pretty good.But i want to create horizontal cluster(where i can use any ip address along with any port no. depending on the configuration). If this is possible in hazelCast then please share how. i went through several links like http://www.hazelcast.com/docs/1.9.4/manual/multi_html/ch11.html
if this link is useful the suggest me how. I made only change to hazelcast.xml.
<tcp-ip enabled="true">
<hostname>172.22.65.111</hostname>
<hostname>172.22.68.19</hostname>
<interface>172.22.*.*</interface>
</tcp-ip>

在两个系统上都使用相同的 jar 文件。我创建一个 map 名称“xyz”并向其存储一些值。然后它应该可用于具有相同 map 名称“xyz”的其他系统。 这是我在我的系统上使用的代码 clientConfig.addAddress("172.22.65.111:5701"); System.out.println("p2"); HazelcastInstance 客户端 = HazelcastClient .newHazelcastClient(clientConfig);

            IMap<Integer, String> map = client.getMap("m");
map.put(1,"ram");

除了 IP 和端口之外,第二个系统上也有相同的代码。相反,我正在尝试进入其他系统。

最佳答案

您的链接引用的是过时版本的手册。如果您按照

上的入门指南进行操作

http://www.hazelcast.com/docs/3.0/manual/single_html/#GettingStarted

您应该能够通过在两台单独的计算机上启动示例代码来形成水平集群。

当前的 hazelcast 发行版还包含一个包含示例应用程序的 bin 文件夹。

关于java - 使用 HazelCast 进行水平聚类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18863686/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com