[英]How do I bind a hazelcast node to a specific ip address?
I tried running this code, but it gives me an error. 我尝试运行此代码,但它给了我一个错误。 It seems that I can't bind to a specific ip address; 似乎我无法绑定到特定的IP地址; rather I need to bind to a network interface. 而我需要绑定到网络接口。 is there any way around this issue? 有没有解决这个问题的方法?
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()
}
I'm getting java.lang.RuntimeException: Hazelcast CANNOT start on this node. No matching network interface found.
我收到了java.lang.RuntimeException: Hazelcast CANNOT start on this node. No matching network interface found.
java.lang.RuntimeException: Hazelcast CANNOT start on this node. No matching network interface found.
Check this section of the documentation & the link in the doc: https://docs.hazelcast.org/docs/latest/manual/html-single/index.html#discovering-members-by-tcp 请查看文档的此部分以及文档中的链接: https : //docs.hazelcast.org/docs/latest/manual/html-single/index.html#discovering-members-by-tcp
What you need is to disable Hazelcast to bind all interfaces by setting hazelcast.socket.bind.any
to false
. 你需要的是通过将hazelcast.socket.bind.any
设置为false
来禁用Hazelcast来绑定所有接口。 Then, you can use the Interfaces as described in here: https://docs.hazelcast.org/docs/latest/manual/html-single/index.html#interfaces 然后,您可以使用此处所述的接口: https : //docs.hazelcast.org/docs/latest/manual/html-single/index.html#interfaces
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.