Problem with Transport client and elasticsearch cluster behind load balancer



I try to use elasticsearch for "search suggestion" in a java-webapplication.
There are 2 nodes in the cluster behind a load balancer.
I use elasticsearch 1.5

My problem is, if I use Transport Client with node host addresses there is no problem.

Client transportClient = new TransportClient(settings())
.addTransportAddress(new InetSocketTransportAddress("", 9300))
.addTransportAddress(new InetSocketTransportAddress("", 9300));

but if I try to use the load balancer with load balancer host address

Client client = new TransportClient(settings())
.addTransportAddress(new InetSocketTransportAddress("", 80));

I get an error
elasticsearch[Blue Diamond][transport_client_worker][T#20]{New I/O worker #20} deploymentPhase
WARN org.elasticsearch.transport.netty - [Blue Diamond] exception caught on transport layer [[id: 0x6f6cd7f0, / =>]], closing connection Die Wartezeit fuer die Verbindung ist abgelaufen // =time out
at Method)
at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$
at java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.util.concurrent.ThreadPoolExecutor$

and the second error:
None of the configured nodes were available: [[suggest1][l6ReVYRRSeqz8CT9aSHnEA][][inet[]]]

Can somebody help me to find a solution for this problem?

best regards,

(Igor Motov) #2

Transport client establishes and maintains connections with other nodes and performs load balancing and fault detection between these connection. An external load balancing is hindering with this process in two ways - first of all it breaks idle connections (I think this is main cause for the error that you are seeing) and second since the transport client establishes the connection only ones, the load balancer basically limits the communication from the transport client to a single node that it connected to. In other words using load balancer on the transport protocol is a bad idea. You should ether remove the load balancer, or switch to REST client if having load balancer between the client and elasticsearch is a requirement.

(Sina) #3

Great help, thx

(system) #4