Re: [jgroups-users] Chat doesn't work for specific user

Questions/problems related to using JGroups <[email protected]> Thu, 18 May 2017 10:23:29 +0200
Newsgroups gmane.comp.java.javagroups.general
Message-ID <[email protected]>

On 18/05/17 10:10, Questions/problems related to using JGroups wrote:
> Thanks for the help. I think I can now find a workaround for this.
>
> Wouldn't it be a nice feature of JGroups if it would pick an interface
> for me but if this leads to an exception it would automatically choose
> the next non-local network interface?

Picking an interface in UP mode won't throw an exception when you bind 
to it. However, when you send a packet, the route might point to nowhere 
(e.g. if you send over a VPN tunnel that's not connected (but still UP)).

If you show me code that fails and code which fixes this, I'm more than 
happy to add it to JGroups!

> In the environment where I run I
> don't know in advance the hostname I should bind to.

What about the NIC name of IP address? In the latter case you could 
define bind_addr="match-address:10.5.\*" so an address starting with 
10.5.x.x are selected.

Note that you can *chain* these, e.g.
bind_addr="match-interface:eth0,site-local,match-address:192.168.*"


> I know the hostname through which I am reachable from the internet, but the local hostname
> which should be used to address me from inside the same network segment
> in our cloud is not known to me.

Which cloud are you running on? EC2 lets you fetch your hostname via a 
REST call to a special IP address (169.164.x.x?).

With the combination of symbolic names, match-xxx notations and 
chaining, you should be able to always pick the right bind address in 
99% of all cases. If not, you can always run your own code to retrieve 
the bind address and set it programmatically in the code.

-- 
Bela Ban | http://www.jgroups.org


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot