gpt4 book ai didi

java - 当我启用 tcp-ip 时,为什么 Hazelcast 需要多播?

转载 作者:行者123 更新时间:2023-12-04 13:58:44 29 4
gpt4 key购买 nike

我正在尝试设置 2 台机器 Hazelcast 集群,并且无法使用多播。这是我用于配置的 xml 文件:

<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config http://www.hazelcast.com/schema/config/hazelcast-config-3.9.xsd" xmlns="http://www.hazelcast.com/schema/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<network>
<port auto-increment="true">5701</port>
<join>
<multicast enabled="false">
</multicast>
<tcp-ip enabled="true">
<member>10.18.7.4</member>
<member>10.18.14.63</member>
</tcp-ip>
</join>
</network>
</hazelcast>

我正在实例化 Hazelcast:
        Config config = new FileSystemXmlConfig(xmlConfigFile);
HazelcastInstance hz = Hazelcast.newHazelcastInstance(config);

当我启动每一个时,我可以看到连接已经建立,然后它关闭了节点。这是日志文件中的相关行。两台机器的日志是一样的,只是ip不同。我添加了注释(在 -> 之后)以使其更易于阅读。
WARNING: Name of the hazelcast schema location is incorrect, using default -> Presumable no issue here

INFO: [LOCAL] [dev] [3.12] Interfaces is disabled, trying to pick one address from TCP-IP config addresses: [10.18.14.63, 10.18.7.4]

INFO: [LOCAL] [dev] [3.12] Picked [10.18.14.63]:5702, using socket ServerSocket[addr=/0.0.0.0,localport=5702], bind any local is true

INFO: [10.18.14.63]:5702 [dev] [3.12] Hazelcast 3.12 (20190409 - 915d83a) starting at [10.18.14.63]:5702 -> Great, we're starting Hazelcast on this machine.

INFO: [10.18.14.63]:5702 [dev] [3.12] Starting 2 partition threads and 3 generic threads (1 dedicated for priority tasks) -> Looking good

INFO: [10.18.14.63]:5702 [dev] [3.12] [10.18.14.63]:5702 is STARTING -> Ok looks like we've started.

INFO: [10.18.14.63]:5702 [dev] [3.12] Connecting to /10.18.7.4:5702, timeout: 10000, bind-any: true -> Trying to connect to the other machine

INFO: [10.18.14.63]:5702 [dev] [3.12] Connecting to /10.18.7.4:5703, timeout: 10000, bind-any: true -> Still trying to connect to the other machine

INFO: [10.18.14.63]:5702 [dev] [3.12] Initialized new cluster connection between /10.18.14.63:44251 and /10.18.14.63:5701 -> Ok started a cluster connection on this machine.

INFO: [10.18.14.63]:5702 [dev] [3.12] Initialized new cluster connection between /10.18.14.63:38941 and /10.18.7.4:5701 -> Great, started a connection with the other machine

SEVERE: [10.18.14.63]:5702 [dev] [3.12] Node could not join cluster. A Configuration mismatch was detected: Incompatible joiners! expected: multicast, found: tcp-ip Node is going to shutdown now! -> This is the error I don't understand.

Apr 22, 2019 6:57:44 PM com.hazelcast.instance.Node
WARNING: [10.18.14.63]:5702 [dev] [3.12] Terminating forcefully...

Apr 22, 2019 6:57:44 PM com.hazelcast.instance.Node
INFO: [10.18.14.63]:5702 [dev] [3.12] Shutting down connection manager...

我的第一个问题是,如果我设置 multicast enabled="false"在 xml 配置文件中,为什么我会收到此消息 Node could not join cluster. A Configuration mismatch was detected: Incompatible joiners! expected: multicast, found: tcp-ip Node is going to shutdown now! ,然后就关机了?

我的第二个问题是,如何正确配置 xml 文件以使用 tcp-ip 创建 2 节点集群,而不是多播?

感谢您的帮助。

最佳答案

您必须确保集群的所有成员都支持相同的发现机制。确保在两个节点上都只启用了 tcp joiner。这应该足以解决您的问题。
或者,您可以尝试从两个节点上的 xml 中删除“多播”部分,只保留 tcp(我没有尝试过,但我认为它应该类似于禁用多播部分)。
您可以在此阅读 issue当集群节点之一出现配置错误时,此错误很常见。
Amit Kumar 添加的更新:
我注意到一些默认的hazelcast 配置正在运行,即首先从hazelcast .jar hazelcast.xml 加载,然后在运行我的配置hazelcast.xml 之后。
自定义 hazelcast.xml 中指示了网络端口“5721”,但仍会在端口“5701”和“5702”上启动实例。

Members {size:1, ver:1} [
Member [192.168.1.102]:5701 - ecdb61e1-ac24-45dc-826d-9d807fed5f71 this
]

Members {size:1, ver:1} [
Member [192.168.1.102]:5721 - 96c55f82-eefd-401f-9aca-a51e288ccb2a this
]

关于java - 当我启用 tcp-ip 时,为什么 Hazelcast 需要多播?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55799913/

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