我试着运行这段代码,但它给了我一个错误。似乎我不能绑定到特定的ip地址;相反,我需要绑定到网络接口。有什么办法可以解决这个问题吗?
import io.vertx.core.VertxOptions
import io.vertx.reactivex.core.Vertx
import io.vertx.spi.cluster.hazelcast.{ ConfigUtil, HazelcastClusterManager }
object Test extends App {
val host = "127.0.0.2"
def getConfig(): Config = {
import scala.collection.JavaConverters._
val config = ConfigUtil.loadConfig()
config.setProperty("hazelcast.socket.bind.any", "false")
config
.getNetworkConfig
.setPortAutoIncrement(false)
.getInterfaces
.setEnabled(true)
.setInterfaces(List(s"127.0.0.2").asJava)
val joinConfig = config.getNetworkConfig.getJoin
joinConfig
.getMulticastConfig
.setEnabled(false)
config
}
def run(): Unit = {
val mgr = new HazelcastClusterManager(getConfig())
val options = new VertxOptions().setClusterManager(mgr)
options.getEventBusOptions.setHost(host)
val vrtx = Vertx.rxClusteredVertx(options).blockingGet()
}
run()
}我去找java.lang.RuntimeException: Hazelcast CANNOT start on this node. No matching network interface found.
发布于 2019-04-17 02:30:59
查看文档的这一部分&文档中的链接:https://docs.hazelcast.org/docs/latest/manual/html-single/index.html#discovering-members-by-tcp
您需要通过将hazelcast.socket.bind.any设置为false来禁用Hazelcast以绑定所有接口。然后,您可以使用此处所述的接口:https://docs.hazelcast.org/docs/latest/manual/html-single/index.html#interfaces
https://stackoverflow.com/questions/55695591
复制相似问题