Transport client 5.5.2 not working from Tomcat for me in EC2


(Shantanu Banerjee) #1

I have used the following configuration in a single node cluster in Ec2.
Version 5.5.2
elasticsearch.yml...
(important settings)
cluster.name: blashblah
node.name: node1
network.host: 172.31.18.254 #private IP
network.publish_host: 13.250.10.159 #public IP

TransportClient snippet:
........
Builder settingsBuilder = Settings.builder();
settingsBuilder.put("cluster.name", clusterName);
//settingsBuilder.put("client.transport.sniff","false");
Settings settings = settingsBuilder.build();

		TransportClient transportClient = new PreBuiltTransportClient(settings);
		String[] nodes = nodeDetails.split(",");
		String[] nodeIpPort;
		for (String node : nodes) {
			nodeIpPort = node.split(":");
			try {
				transportClient.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(nodeIpPort[0]),
						Integer.parseInt(nodeIpPort[1])));
				client = transportClient;

.......................

I could connect from my localhost using transport client.

But from Ec2, I am getting issues. Though initially it says that it has connect, shortly thereafter
it says that it could not.

[DEBUG] 2018-01-02 17:12:07.735 [localhost-startStop-1] Recycler - -Dio.netty.recycler.maxSharedCapacityFactor: disabled
[DEBUG] 2018-01-02 17:12:07.735 [localhost-startStop-1] Recycler - -Dio.netty.recycler.linkCapacity: disabled
[DEBUG] 2018-01-02 17:12:07.735 [localhost-startStop-1] Recycler - -Dio.netty.recycler.ratio: disabled
[DEBUG] 2018-01-02 17:12:07.815 [localhost-startStop-1] Netty4Transport - connected to node [{node1}{_ENXVRE5QwOLVCbWqYddIQ}{Bu7cVvi-RDWrgqhRGj7qTA}{13.250.10.159}{13.250.10.159:9300}]
[DEBUG] 2018-01-02 17:12:07.816 [localhost-startStop-1] JndiTemplate - Looking up JNDI object with name [java:comp/env/spring.liveBeansView.mbeanDomain]
[DEBUG] 2018-01-02 17:12:07.816 [localhost-startStop-1] JndiLocatorDelegate - Converted JNDI name [java:comp/env/spring.liveBeansView.mbeanDomain] not found - trying original name [spring.liveBeansView.mbeanDomain]. javax.naming.NameNotFoundException: Name [spring.liveBeansView.mbeanDomain] is not bound in this Context. Unable to find [spring.liveBeansView.mbeanDomain].
[DEBUG] 2018-01-02 17:12:07.816 [localhost-startStop-1] JndiTemplate - Looking up JNDI object with name [spring.liveBeansView.mbeanDomain]
[DEBUG] 2018-01-02 17:12:07.816 [localhost-startStop-1] JndiPropertySource - JNDI lookup for name [spring.liveBeansView.mbeanDomain] threw NamingException with message: Name [spring.liveBeansView.mbeanDomain] is not bound in this Context. Unable to find [spring.liveBeansView.mbeanDomain].. Returning null.
[DEBUG] 2018-01-02 17:12:07.816 [localhost-startStop-1] PropertySourcesPropertyResolver - Could not find key 'spring.liveBeansView.mbeanDomain' in any property source
[DEBUG] 2018-01-02 17:12:07.816 [localhost-startStop-1] DispatcherServlet - Published WebApplicationContext of servlet 'mvc-dispatcher' as ServletContext attribute with name [org.springframework.web.servlet.FrameworkServlet.CONTEXT.mvc-dispatcher]
[INFO ] 2018-01-02 17:12:07.816 [localhost-startStop-1] DispatcherServlet - FrameworkServlet 'mvc-dispatcher': initialization completed in 2128 ms
[DEBUG] 2018-01-02 17:12:07.816 [localhost-startStop-1] DispatcherServlet - Servlet 'mvc-dispatcher' configured successfully
[DEBUG] 2018-01-02 17:12:47.620 [elasticsearch[client][generic][T#2]] TransportClientNodesService - failed to connect to node [{#transport#-1}{yK9qHGiYR5KY5QtuuTDUoA}{13.250.10.159}{13.250.10.159:9300}], ignoring...
org.elasticsearch.transport.ConnectTransportException: [][13.250.10.159:9300] handshake_timeout[30s]
at org.elasticsearch.transport.TcpTransport.executeHandshake(TcpTransport.java:1614) ~[elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.transport.TcpTransport.openConnection(TcpTransport.java:555) ~[elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.transport.TcpTransport.openConnection(TcpTransport.java:116) ~[elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.transport.TransportService.openConnection(TransportService.java:351) ~[elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.client.transport.TransportClientNodesService$SimpleNodeSampler.doSample(TransportClientNodesService.java:407) [elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.client.transport.TransportClientNodesService$NodeSampler.sample(TransportClientNodesService.java:357) [elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.client.transport.TransportClientNodesService$ScheduledNodeSampler.run(TransportClientNodesService.java:390) [elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:569) [elasticsearch-5.5.2.jar:5.5.2]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_151]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_151]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_151]

I have written a small test program to do the same things that I was doing in the web application above and it succeeded from EC2.

NOW MY QUESTION IS THAT THE FAILURE LOGS ARE INSUFFICIENT TO FIND OUT WHAT
IS HAPPENING HERE.
CAN SOMEONE SUGGEST SOME TOOLS OR ADDL. CODE TO PROBE FURTHER.


(Alexander Reelsen) #2

have you written a small program to check if you can connect only or also send data?

The handshake timeout seems to indicate that connecting may have worked but no data could be exchanged. Also, by configuring the publish host you should make sure, that you can connect to this one as well - and of course make sure, that one is not exposed to the internet and leaves Elasticsearch open.


(Shantanu Banerjee) #3

Hi spinscale,
Thanks for taking the time to reply.

The issue just got resolved. I just increased the heap allocation
and it started working.
My program is running on Tomcat / Java 8, BTW.
I may have eaten some exceptions in my code or some
other used code may have.

If you have any better explanation please let me know.
But for now, my issue is resolved.
I need to close it.
Thanks!


(system) #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.