Re: [javagroups-users] How to get the IP address of a member
Brought to you by:
belaban
From: Bela B. <be...@ya...> - 2011-01-25 15:46:39
|
You could do both. When a new member starts, after joining the cluster it could broadcast its IP address via a message. Any node could also send a request message, asking a node for its address, in case it doesn't have it. When a new member starts, everyone could send its information to it. An alternative could be to use the logical name of a channel. You could name a channel on 192.168.1.5 port 7500 "<hostname>-192.168.1.5:7500", then Channel.getName() would return it. On 1/25/11 4:17 PM, Dov Rosenberg wrote: > Would that be a one time broadcast or would there be some sort of > interrogation protocol? I am interested from a perspective of being able to > identify the hosts in the network and potentially provide some sort of > system management capability for our apps > > > Thanks > > Dov Rosenberg > > On 1/25/11 9:56 AM, "Tom van Zummeren"<to...@jt...> wrote: > >> Broadcasting it was my alternative idea. But it just sounded more obvious to >> me if JGroups could provide me with this information. But if it is not >> recommended to ask JGroups for the IP address I will not do that and broadcast >> the IP instead. >> >> Thanks again! >> >> >> On Jan 25, 2011, at 3:49 PM, Bela Ban wrote: >> >>> JChannel ch; >>> >>> PhysicalAddress addr=(PhysicalAddress)ch.downcall(new >>> Event(Event.GET_PHYSICAL_ADDRESS, ch.getAddress())); >>> if(addr instanceof IpAddress) { >>> // downcast and use >>> } >>> >>> >>> HOWEVER, this is *not* recommended, as the GET_PHYSICAL_ADDRESS is an >>> internal event, and might get changed anytime... >>> >>> If you need this info, why don't you broadcast it via your app ? >>> >>> >>> On 1/25/11 3:13 PM, Tom van Zummeren wrote: >>>> Hi Bela, >>>> >>>> In my application I need to discover the IP address (InetAddress actually) >>>> of all members in the group. Is there a way to ask JChannel for the IP >>>> address for example? All I get now is a generic Address instance which >>>> identifies a member but does not contain an IP address (it uses UUID as the >>>> Address implementation). >>>> >>> -- Bela Ban Lead JGroups / Clustering Team JBoss |