无法在云环境的 Verticles 之间建立 vert.x 集群
Fail to establish vert.x cluster between verticles on cloud environment
在云环境中建立vert.x集群失败
我在配置私有云环境中的 vert.x 事件总线时遇到问题。
在实验室测试中,我正在尝试使用 Hazelcast 集群管理器创建两个 Verticle 来建立一个集群,每个 Verticle 在您自己的容器中运行。
问题可能是配置错误引起的,但我无法找到它。
在此云上无法进行多播调用,因此我正在使用 TCP IP 发现策略。
最初的计划是制作一个 "labatf-api" verticle(一个 REST 调用接收器),它将通过 eventbus 传播业务处理,在 "labatf-vtx" verticle 中执行。
下面是配置"labatf-api"verticle的集群片段的代码:
Config hazelcastConfig = new Config();
NetworkConfig networkConfig = new NetworkConfig();
networkConfig
.setPort(5701)
.getJoin()
.getMulticastConfig()
.setEnabled(false);
networkConfig
.getJoin()
.getAwsConfig()
.setEnabled(false);
networkConfig
.getJoin()
.getTcpIpConfig()
.setEnabled(true)
.addMember("labatf-vtx:5701");
hazelcastConfig.setNetworkConfig(networkConfig);
ClusterManager mgr = new HazelcastClusterManager(hazelcastConfig);
VertxOptions options = new VertxOptions()
.setClusterManager(mgr)
.setEventBusOptions(new EventBusOptions()
.setClusterPublicHost("labatf-api")
.setClusterPublicPort(5701))
.setClustered(true);
Vertx.clusteredVertx(options, res -> {
if (res.succeeded()) {
...
}
});
和"labatf-api" verticle代码:
Config hazelcastConfig = new Config();
NetworkConfig networkConfig = new NetworkConfig();
networkConfig
.setPort(5701)
.getJoin()
.getMulticastConfig()
.setEnabled(false);
networkConfig
.getJoin()
.getAwsConfig()
.setEnabled(false);
networkConfig
.getJoin()
.getTcpIpConfig()
.setEnabled(true)
.addMember("labatf-api:5701");
hazelcastConfig.setNetworkConfig(networkConfig);
ClusterManager mgr = new HazelcastClusterManager(hazelcastConfig);
VertxOptions options = new VertxOptions()
.setClusterManager(mgr)
.setEventBusOptions(new EventBusOptions()
.setClusterPublicHost("labatf-vtx")
.setClusterPublicPort(5701))
.setClustered(true);
Vertx.clusteredVertx(options, res -> {
if (res.succeeded()) {
...
}
});
注意,"labatf-api"和"labatf-vtx"是云环境中的模块名,但它们也是服务IP的域名,这将平衡每个模块的容器副本之间的调用,如果它们存在。
启动Verticles容器后,每个模块发现另一个,但几秒钟后连接被目标节点中断,如下日志:
在 "labatf-api" verticle:
INFO: [192.168.84.205]:5701 [dev] [3.9] Accepting socket connection from /192.168.80.253:52191
INFO: [192.168.84.205]:5701 [dev] [3.9] Established socket connection between /192.168.84.205:5701 and /192.168.80.253:52191
WARNING:[192.168.84.205]:5701 [dev] [3.9] Wrong bind request from [192.168.80.253]:5701! This node is not the requested endpoint: [labatf-api]:5701
INFO: [192.168.84.205]:5701 [dev] [3.9] Connection[id=2, /192.168.84.205:5701->/192.168.80.253:52191, endpoint=null, alive=false, type=MEMBER] closed. Reason: Wrong bind request from [192.168.80.253]:5701! This node is not the requested endpoint: [labatf-api]:5701
INFO: [192.168.84.205]:5701 [dev] [3.9] Connection[id=5, /192.168.84.205:45323->labatf-vtx/10.36.232.241:5701, endpoint=[labatf-vtx]:5701, alive=false, type=MEMBER] closed. Reason: Connection closed by the other side
在 "labatf-vtx" verticle:
INFO: [192.168.80.253]:5701 [dev] [3.9] Accepting socket connection from /192.168.84.205:60711
INFO: [192.168.80.253]:5701 [dev] [3.9] Established socket connection between /192.168.80.253:5701 and /192.168.84.205:60711
WARNING: [192.168.80.253]:5701 [dev] [3.9] Wrong bind request from [192.168.84.205]:5701! This node is not the requested endpoint: [labatf-vtx]:5701
INFO: [192.168.80.253]:5701 [dev] [3.9] Connection[id=3, /192.168.80.253:5701->/192.168.84.205:60711, endpoint=null, alive=false, type=MEMBER] closed. Reason: Wrong bind request from [192.168.84.205]:5701! This node is not the requested endpoint: [labatf-vtx]:5701
INFO: [192.168.80.253]:5701 [dev] [3.9] Connection[id=4, /192.168.80.253:55987->labatf-api/10.36.212.47:5701, endpoint=[labatf-api]:5701, alive=false, type=MEMBER] closed. Reason: Connection closed by the other side
欢迎提供任何帮助!
您无法通过负载均衡器连接 Hazelcast 节点。 Hazelcast 节点必须直接相互对话。我们不使用 HTTP(S),而是使用基于 TCP/IP 的自定义协议。
在云环境中建立vert.x集群失败
我在配置私有云环境中的 vert.x 事件总线时遇到问题。
在实验室测试中,我正在尝试使用 Hazelcast 集群管理器创建两个 Verticle 来建立一个集群,每个 Verticle 在您自己的容器中运行。
问题可能是配置错误引起的,但我无法找到它。 在此云上无法进行多播调用,因此我正在使用 TCP IP 发现策略。
最初的计划是制作一个 "labatf-api" verticle(一个 REST 调用接收器),它将通过 eventbus 传播业务处理,在 "labatf-vtx" verticle 中执行。
下面是配置"labatf-api"verticle的集群片段的代码:
Config hazelcastConfig = new Config();
NetworkConfig networkConfig = new NetworkConfig();
networkConfig
.setPort(5701)
.getJoin()
.getMulticastConfig()
.setEnabled(false);
networkConfig
.getJoin()
.getAwsConfig()
.setEnabled(false);
networkConfig
.getJoin()
.getTcpIpConfig()
.setEnabled(true)
.addMember("labatf-vtx:5701");
hazelcastConfig.setNetworkConfig(networkConfig);
ClusterManager mgr = new HazelcastClusterManager(hazelcastConfig);
VertxOptions options = new VertxOptions()
.setClusterManager(mgr)
.setEventBusOptions(new EventBusOptions()
.setClusterPublicHost("labatf-api")
.setClusterPublicPort(5701))
.setClustered(true);
Vertx.clusteredVertx(options, res -> {
if (res.succeeded()) {
...
}
});
和"labatf-api" verticle代码:
Config hazelcastConfig = new Config();
NetworkConfig networkConfig = new NetworkConfig();
networkConfig
.setPort(5701)
.getJoin()
.getMulticastConfig()
.setEnabled(false);
networkConfig
.getJoin()
.getAwsConfig()
.setEnabled(false);
networkConfig
.getJoin()
.getTcpIpConfig()
.setEnabled(true)
.addMember("labatf-api:5701");
hazelcastConfig.setNetworkConfig(networkConfig);
ClusterManager mgr = new HazelcastClusterManager(hazelcastConfig);
VertxOptions options = new VertxOptions()
.setClusterManager(mgr)
.setEventBusOptions(new EventBusOptions()
.setClusterPublicHost("labatf-vtx")
.setClusterPublicPort(5701))
.setClustered(true);
Vertx.clusteredVertx(options, res -> {
if (res.succeeded()) {
...
}
});
注意,"labatf-api"和"labatf-vtx"是云环境中的模块名,但它们也是服务IP的域名,这将平衡每个模块的容器副本之间的调用,如果它们存在。
启动Verticles容器后,每个模块发现另一个,但几秒钟后连接被目标节点中断,如下日志:
在 "labatf-api" verticle:
INFO: [192.168.84.205]:5701 [dev] [3.9] Accepting socket connection from /192.168.80.253:52191
INFO: [192.168.84.205]:5701 [dev] [3.9] Established socket connection between /192.168.84.205:5701 and /192.168.80.253:52191
WARNING:[192.168.84.205]:5701 [dev] [3.9] Wrong bind request from [192.168.80.253]:5701! This node is not the requested endpoint: [labatf-api]:5701
INFO: [192.168.84.205]:5701 [dev] [3.9] Connection[id=2, /192.168.84.205:5701->/192.168.80.253:52191, endpoint=null, alive=false, type=MEMBER] closed. Reason: Wrong bind request from [192.168.80.253]:5701! This node is not the requested endpoint: [labatf-api]:5701
INFO: [192.168.84.205]:5701 [dev] [3.9] Connection[id=5, /192.168.84.205:45323->labatf-vtx/10.36.232.241:5701, endpoint=[labatf-vtx]:5701, alive=false, type=MEMBER] closed. Reason: Connection closed by the other side
在 "labatf-vtx" verticle:
INFO: [192.168.80.253]:5701 [dev] [3.9] Accepting socket connection from /192.168.84.205:60711
INFO: [192.168.80.253]:5701 [dev] [3.9] Established socket connection between /192.168.80.253:5701 and /192.168.84.205:60711
WARNING: [192.168.80.253]:5701 [dev] [3.9] Wrong bind request from [192.168.84.205]:5701! This node is not the requested endpoint: [labatf-vtx]:5701
INFO: [192.168.80.253]:5701 [dev] [3.9] Connection[id=3, /192.168.80.253:5701->/192.168.84.205:60711, endpoint=null, alive=false, type=MEMBER] closed. Reason: Wrong bind request from [192.168.84.205]:5701! This node is not the requested endpoint: [labatf-vtx]:5701
INFO: [192.168.80.253]:5701 [dev] [3.9] Connection[id=4, /192.168.80.253:55987->labatf-api/10.36.212.47:5701, endpoint=[labatf-api]:5701, alive=false, type=MEMBER] closed. Reason: Connection closed by the other side
欢迎提供任何帮助!
您无法通过负载均衡器连接 Hazelcast 节点。 Hazelcast 节点必须直接相互对话。我们不使用 HTTP(S),而是使用基于 TCP/IP 的自定义协议。