Ask Your Question

How to programtically get info about number of members in a Cluster

asked 2017-05-10 03:36:45 -0700

sarraju gravatar image

Hi All,

Iam wondering how to get number of nodes running in the cluster from my Java Application running on one of those nodes.

Here is what i analysed so far : 1. Could not get any direct cluster API 2. I could see that i can use jolokia-client-java library and write a java program to do a GET on akka:type=Cluster but iam not still sure if that can give me the info iam looking for. Mainly i can send a GET request on localhost and not sure if akka Cluster MBean will be running all the nodes in the cluster. 3. Or do i need to make my application an Actor and then access Cluster context ?

Any pointers would be of great help. Atleast if using jolokia is the only way to programatically get access to Cluster info, mainly number of nodes running.

Regards Yugandhar

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2017-05-13 08:58:11 -0700

sarraju gravatar image

Ok, let me answer myself :-), I found one way of doing it, not sure if its the only way.

http://localhost:8080/jolokia/read/ak... -> Then read Members which lists all nodes in cluster. This way my application running on any node in cluster would know how many other nodes are running in the cluster.

8080 atleast with my Beryllium release.

Hope this helps.

Regards Yugandhar

edit flag offensive delete publish link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-05-10 03:36:45 -0700

Seen: 10 times

Last updated: May 13