首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >kubernetes上的集群Vert.x -事件总线不向远程使用者发送消息

kubernetes上的集群Vert.x -事件总线不向远程使用者发送消息
EN

Stack Overflow用户
提问于 2019-06-02 15:06:33
回答 1查看 385关注 0票数 0

我在Kubernetes平台上设置了vert.x / hazelcast集群:

  • 2个实例/ Pods正在运行
  • 通过Kubernetes的Hazelcast发现插件进行配置
  • 使用Kubernetes API作为发现方法。

Hazelcast集群本身没有问题。我可以看到,这个小组由两名成员组成:

代码语言:javascript
复制
[100.116.0.36]:5701 [dev] [3.12] 

Members {size:2, ver:8} [
    Member [100.122.0.1]:5701 - 4d42a914-a6a5-4d65-897d-835eb5f5da4d
    Member [100.116.0.36]:5701 - be0010b5-1a0e-4359-bc94-70078fe4f2d4 this
]

我还使用了Hazelcast提供的共享地图,它在两个吊舱之间同步。

不过,Vert.x本身正在记录以下警告:

代码语言:javascript
复制
Connecting to server localhost:41635 failedConnection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:325)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:340)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:634)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:581)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:498)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:460)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)

Connecting to server localhost:37251 failedConnection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:325)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:340)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:634)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:581)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:498)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:460)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)

这些消息可能不会直接链接到vert.x,但是当它以本地模式启动时,它们就会消失。

我还使用千分尺设置了监视,vert.x没有为vertx_eventbus_bytesWritten提供任何值,如下所示:https://vertx.io/docs/vertx-micrometer-metrics/java/

因此,我确信vert.x只因为这些警告才将所有消息发送给本地消费者。

在集群模式下安装vert.x的方式如下:

代码语言:javascript
复制
VertxOptions vertxOptions = new VertxOptions();
vertxOptions.getEventBusOptions().setClustered(true);
vertxOptions.setClusterManager(new HazelcastClusterManager(hazelcastInstance)); // the hazelcast instance itself is setup by spring boot which i'm using for dependency injection

Vertx.rxClusteredVertx(vertxOptions).doOnSuccess((result -> {
            LOGGER.info("Clustered vertx setup complete. Deploying vertices....");
           // ...
        })).doOnError((throwable -> {
            LOGGER.error("Failed to setup clustered verx.", throwable);
        }));

不提供任何错误日志。

对这里出了什么问题有什么想法吗?会非常感激的。

EN

回答 1

Stack Overflow用户

发布于 2019-06-03 08:45:17

如果手动创建VertxOptions,则必须设置clusterHost设置:

代码语言:javascript
复制
vertxOptions.getEventBusOptions().setClusterHost("the-pod-address")

集群主机默认为localhost,这就是集群通信失败的原因。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56416243

复制
相关文章

相似问题

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