-
Notifications
You must be signed in to change notification settings - Fork 156
Closed
Description
Connects to basho/riak-clients#1
When customers are using a load balancer, the load balancer can add and remove IP’s dynamically. When an IP is removed, the Riak client fails in two subtle ways.
- If the previous connect was created less than
DNSTTLtimespan ago, the Java client gets another connection. If it is more then a full process of doing a DNS check and getting a connection is followed. If an IP has been dynamically changed in the “less than” timespan, issues arise. - If a domain name is being used, the Java client gets only the IP addresses for it on
RiakNode:start. If the load balancer changes IP address, theInetSocketAddressis never updated as the Java client never does another DNS lookup for the domain name case, meaning we never know if the IP address changes.
One customer implemented a fix in their system by changing the doGetConnection() method in the following way:
InetSocketAddress socketAddress = new InetSocketAddress(remoteAddress, port);
bootstrap.handler(new RiakChannelInitializer(this))
.remoteAddress(socketAddress);
Before this call:
ChannelFuture f = bootstrap.connect();
Additionally, the fix included adding the java opt -Dsun.net.inetaddr.ttl=10.
This fix has been tested by @A1 although, of course, other fixes may be possible.
Reactions are currently unavailable