Hazelcast 警告i.v.c.e.i.clustered.ConnectionHolder失败
我收到一条错误消息:Hazelcast 警告i.v.c.e.i.clustered.ConnectionHolder失败,hazelcast,vert.x,Hazelcast,Vert.x,我收到一条错误消息: 10:29:56.116 [vert.x-worker-thread-18] WARN i.v.c.e.i.clustered.ConnectionHolder - Connecting to server localhost:53990 failed 为此,我找到了讨论: 其中一个答复是: 如何启动Vert.x?CLI和Launcher类中有一个主机名检测机制。 如果您有自己的主类,请确保正确设置ClusterHost选项 所以我在书中寻找描述 上面说: 在集群模式下
10:29:56.116 [vert.x-worker-thread-18] WARN i.v.c.e.i.clustered.ConnectionHolder - Connecting to server localhost:53990 failed
为此,我找到了讨论:
其中一个答复是:
如何启动Vert.x?CLI和Launcher类中有一个主机名检测机制。
如果您有自己的主类,请确保正确设置ClusterHost选项
所以我在书中寻找描述
上面说:
在集群模式下运行Vert.x时,还应确保Vert.x知道正确的接口。在命令行上运行时,可通过指定群集主机选项来完成此操作:
vertx运行myverticle.js-cluster-cluster主机您的ip地址
其中,您的ip地址与您在Hazelcast配置中指定的ip地址相同。
如果以编程方式使用Vert.x,则可以使用setClusterHost指定此选项
我不明白这一点,因为我假设localhost会很好。我正在尝试两节点配置,请参见
需要什么来理解和解决这个问题
展示另一个初学者可能会把事情搞砸的场景。我如何调试它?日志输出显示,所涉及的两个vert.x客户端确实通过多播Joiner x.y.z正确连接,隐藏了真正的ip:
08:42:09.539 [hz._hzInstance_1_dev.priority-generic-operation.thread-0] INFO c.h.internal.cluster.ClusterService - [x.y.z.82]:5701 [dev] [3.12.5]
Members {size:2, ver:8} [
Member [x.y.z.82]:5701 - 29b35836-aad1-4314-af62-c453ce200ffa this
Member [x.y.z.25]:5701 - f67995b7-f47e-4037-b7a4-fcedeff4fc91
]
其中一个客户端是raspberry PI,默认情况下,它用一个
删除/etc/hosts中的该条目,并将其替换为具有完整ip地址的正确条目是第一步
cat /etc/hosts
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
# on the main network
x.y.z.82 picarford.bitplan.com picarford
然后主机名需要用作所有成员的主机/群集主机
主机名=InetAddress.getLocalHost.getCanonicalHostName
setClusterHosthostname,主机名
看
/**
*准备开胃菜
*/
公共空间准备{
如果!准备好了吗{
Config.configureLogging;
试一试{
setHostnameInetAddress.getLocalHost.getCanonicalHostName;
}捕获未知后异常{
LOG.error.getMessage;
}
准备好=正确;
}
}
私有字符串主机名;
/**
*配置集群
*@param clusterHostname
*@param publichhost
*/
public void configureClusterString clusterHostname,String publicHost{
如果clusterHostname==null{
clusterHostname=getHostname;
}
如果publicHost==null{
publicHost=getHostname;
}
String msg=String.format在%s上启动群集,将主机设置为%s,将clusterPublicHost设置为%s,getHostname,clusterHostname,publicHost;
LOG.infomsg;
EventBusOptions EventBusOptions=getOptions.getEventBusOptions;
// https://github.com/eclipse-vertx/vert.x/issues/3229
// https://stackoverflow.com/a/49028531/1497139
// https://vertx.io/docs/apidocs/io/vertx/core/eventbus/EventBusOptions.htmlsetClusterPublicHost-java.lang.String-
eventBusOptions.setHostclusterHostname;
eventBusOptions.setClusterPublicHostpublicHost;
}
假设您的节点不在同一台主机上,请尝试将群集主机设置为它们可以相互联系的节点IP,即,假设您有2个节点,节点A位于192.168.0.10,节点B位于192.168.0.20,节点A应将群集主机设置为192.168.0.10,节点B到192.168.0。20@adnan_e-我不明白这一点。您是否有说明多播加入和群集主机配置原则的指针?为什么我必须在这里做一些明确的事情?参见