首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >当我启用tcp-ip时,为什么Hazelcast期望组播?

当我启用tcp-ip时,为什么Hazelcast期望组播?
EN

Stack Overflow用户
提问于 2019-04-23 03:20:10
回答 1查看 2.4K关注 0票数 4

我正在尝试设置一个两台机器的Hazelcast集群,不能使用多播。下面是我用于配置的xml文件:

代码语言:javascript
复制
<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的:

代码语言:javascript
复制
        Config config = new FileSystemXmlConfig(xmlConfigFile);
        HazelcastInstance hz  = Hazelcast.newHazelcastInstance(config);

当我启动每一个节点时,我可以看到建立了连接,然后它关闭了节点。以下是日志文件中的相关行。两台机器的日志是相同的,只是ips不同。我添加了注释(在->之后)以使其更易于阅读。

代码语言:javascript
复制
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...

我的第一个问题是,如果我在xml配置文件中设置了multicast enabled="false",为什么我得到这个消息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节点集群,而不是组播?

谢谢你的帮助。

EN

回答 1

Stack Overflow用户

发布于 2020-06-27 23:29:40

您必须确保群集的所有成员都支持相同的发现机制。确保您只在两个节点上启用了tcp joiner。这应该足以解决您的问题。

或者,您可以尝试从两个节点上的xml中删除“多播”部分,只保留tcp (我还没有尝试过,但我认为这应该类似于禁用多播部分)。

您可以在此issue中了解到,当其中一个群集节点中存在配置错误时,此错误很常见。

由Amit Kumar添加的更新:

我注意到一些默认的hazelcast配置正在运行,即从hazelcast .jar hazelcast.xml加载,然后在运行mine configuration hazelcast.xml之后加载。网络端口"5721“在自定义hazelcast.xml中指明,但实例仍在端口"5701”上启动,然后在"5702“上启动。

代码语言:javascript
复制
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
]
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55799913

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档