简体   繁体   English

如何将hazelcast节点绑定到特定的IP地址?

[英]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.

相关问题 如何获取特定缓存条目所在的infinispan节点的IP地址 - How do i get the ip address of the infinispan node where a specific cache entry is resides 如何将serversocket绑定到特定的IP? - How can I bind serversocket to specific IP? 将ColdFusion SMS网关绑定到特定的IP地址 - Bind a ColdFusion SMS gateway to a specific IP address 当我的客户端计算机上有多个NIC时,如何将(当然是出站)HttpUrlConnection绑定到特定的本地IP地址? - How can I bind an (outbound, of course) HttpUrlConnection to a specific local ip address, when I have multiple NIC on my client machine? 如何显示特定接口的IP地址? - How do you display the IP address for a specific interface? 如何将IP地址绑定到Spring 3 @ModelAttribute? - How to bind IP address to a Spring 3 @ModelAttribute? 如何在Spring RMI设置中绑定IP地址? - How to bind a ip address in Spring rmi settings? 从Hazelcast网格获取Master Ip地址 - Get the Master Ip Address from Hazelcast grid 如何在给定开始和结束 IP 地址的情况下生成 IP 地址范围? - How do I get generate an IP address range given start and end IP address? ServerSocket + client Socket - 如何获取客户端的IP地址? - ServerSocket + client Socket - how do I get IP address of client?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM