Question

I would like to know if there is a way to list, in a JEE application, all nodes/instances and their IP of the cluster we're running on?

Was it helpful?

Solution

GlassFish uses Shoal GMS (Group Management Service) as its clustering framework. You can create an application that joins a Shoal cluster as observer and thus can listen to any GMS events like JOIN, JOIN_AND_READY or FAILURE that are published by the GMS and describe the state of cluster members. You can find some snippets about Shoal GMS in GlassFish 3.1 here.

I hooked up an application to GMS back in the days with GF 2.1 and the way to go was to explicitly join a cluster member programmatically.

A Shoal GMS cluster member (application) is not required to be deployed on the target GlassFish cluster. The cluster members communicate via network. GlassFish does use multicast traffic for this, be aware that this may cause firewall issues.

Via GMS you will only obtain instance names of cluster members. There's no easy link to IP addresses of HTTP listeners, but maybe you can map instances to DNS names.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top