dev691
dev691

Reputation: 1114

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

Upvotes: 3

Views: 2922

Answers (1)

noctarius
noctarius

Reputation: 6094

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();

Upvotes: 11

Related Questions