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.