Reputation: 93
I tried running this code, but it gives me an error. It seems that I can't bind to a specific ip address; 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.
Upvotes: 1
Views: 4115
Reputation: 442
I use Hazelcast IMDG Open Source Edition 3.12, or simply hazelcast 3.12. My config is
hazelcast:
network:
interfaces:
enabled: true
interfaces: [127.0.0.11]
port:
auto-increment: false
join:
multicast:
enabled: false
tcp-ip:
enabled: true
interface: 127.0.0.11
and it failed to start with the same error as the OP reported:
Interfaces is enabled, trying to pick one address matching to one of: [127.0.0.11, 127.0.0.11]
...
Hazelcast CANNOT start on this node. No matching network interface found.
Then I added the 127.0.0.11
IP address to my lo0
interface as the OP commented, and voilà—it got working.
Upvotes: 0
Reputation: 3257
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
What you need is to disable Hazelcast to bind all interfaces by setting hazelcast.socket.bind.any
to false
. Then, you can use the Interfaces as described in here: https://docs.hazelcast.org/docs/latest/manual/html-single/index.html#interfaces
Upvotes: 0