在 Vertx 集群中,cluster host/port 和 public cluster host/port 有什么区别?

In Vertx clustering, what's the difference between cluster host/port and public cluster host/port?

我正在开发一个需要在多台机器上集群的应用程序,所以我必须配置VertxOptions object by setting the cluster host and port on each node (machine), but I came across different methods for setting hosts and ports: setClusterhost/port, setPublicClusterHost/port。有什么区别?

clusterHost 属性 告诉 Vert.x 它应该将套接字绑定到哪个主机。 clusterPublicHost 其他节点应该如何连接。默认情况下,值是相同的,但有时由于代理,您需要一种方法使它们不同。

这在 Javadoc 中有解释:

Set the public facing hostname to be used for clustering. Sometimes, e.g. when running on certain clouds, the local address the server listens on for clustering is not the same address that other nodes connect to it at, as the OS / cloud infrastructure does some kind of proxying. If this is the case you can specify a public hostname which is different from the hostname the server listens at. The default value is null which means use the same as the cluster hostname.