Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the Master Ip Address from Hazelcast grid

I would like to get the masterIpAddress use on the Hazelcast node in HazelcastInsatnceImpl from an instance HazelcastInsatnce.

Somebody know how to do that?

Thanks for your help

like image 411
dev691 Avatar asked Dec 19 '25 04:12

dev691


1 Answers

There is no real master in Hazelcast clusters. The oldest node plays some kind of a special role so you can imagine this one as the "master".

To get this node get retrieve the first element from the memberlist.

Cluster cluster = hazelcastInstance.getCluster();
Set<Member> members = cluster.getMembers();
Member master = members.iterator().next();
like image 86
noctarius Avatar answered Dec 20 '25 20:12

noctarius



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!