Discovering Hazelcast instance in a Spring Boot eco-system
Asked Answered
M

0

6

Background:

We have a set of about 15 Spring Boot applications as microservices. They all run as Docker containers, and run as clusters of one or more instances. We also use Spring Cloud Netflix components such as Eureka and discover the running application instances from the client using Feign/Ribbon.

Question:

As part of the POC exercises, we tested with Redis and Hazelcast for caching and Spring Boot configuration storage. Everything works using Spring Boot, Spring Cloud and Redis/Hazelcast Java client libraries. However, when we deploy Hazelcast in a multi-node peer-to-peer cluster, Hazelcast seems to require a "known" IP address/hostname and the accessible port to be available in the Java client's configuration (with or without Spring). Typically, when Hazelcast is deployed in a multi-instance cluster on ephemeral VM instances (for example, EC2), the IP address and the port information is not available. So we thought of two possible solutions:

  1. Find a way to run Hazelcast as a Spring Boot application, and register it with Eureka as a Discovery Client. That way other Spring Boot applications can use Eureka to discover an instance of Hazelcast dynamically

  2. Find a way in Hazelcast so that it can publish it's IP address and port information dynamically to a central Key/Value store

If anyone has played around with Hazelcast to be able to do either/both of the possible solutions, it would be great if you can share more information on that. If there is a third approach that'd work better, I will be eager to know that as well.

Matchboard answered 10/11, 2015 at 4:58 Comment(3)
Hazelcast does not require known IP addresses. It's just one of discovery strategies. The other strategies might be UDP multicast (which I realize is problematic in some clouds environments) and AWS-specific discovery. See this: docs.hazelcast.org/docs/3.5/manual/html-single/… Hazelcast 3.6 introduces SPI to implement custom discovery strategies. See: github.com/hazelcast/hazelcast/pull/5949Sannyasi
From my reading, I don't seem to find a way where from my (Java) client app, I can dynamically discover Hazelcast server's endpoint. We have placed a Docker watcher process that tells us the location of all newly registered Docker containers and the client is able to locate Hazelcast Docker containers when they come up. But that's ugly. Across VMs or when VMs are not visible to one another, this solution will not work. I'll dig deeper in the SPI documents for 3.6, but so far Hazelcast seems to not have a way to "tell" it's location to anyone outside .Matchboard
hazelcast.atlassian.net/wiki/plugins/servlet/mobile#content/… is exactly what I'm looking for. Thanks for the pointer, Jaromir.Matchboard

© 2022 - 2024 — McMap. All rights reserved.