简体   繁体   中英

Java Elasticsearch-Hadoop None of the configured nodes are available

So I'm running a Hadoop query that requires info from a field in an ElasticSearch index running on an Amazon EC2. Issue is, I keep getting the "None of the configured nodes are available" error. Even more frustrating is that I had this working a couple days ago and then it quit in the middle of the query because of a lack of CPU ops. But my partner didn't know that, so his attempts to figure out why it lost the connection in the middle of a query seemed to have caused this problem. And he doesn't remember what he did.

I know this question has been asked before, but I'm certain my cluster name is right and the query that I'm running on ES shouldn't cause timeouts, and didn't, when it was running before. Additionally, there shouldn't be firewall issues because I am running the program directly on the EC2 instance. And it's a pseudo-distributed single node cluster using yarn. The EC2 instance has an associated Elastic IP (meaning its public IP will remain the same), and is running Amazon's ubuntu image.

Here's the java code (identifying information removed):

public static String getAccountNumber(int fieldValue){
    //tried it without the Settings, but still no dice.
    Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name", "elasticsearch").build();
    TransportClient client = new TransportClient(settings)
       .addTransportAddress(new InetSocketTransportAddress("ec2-<ELASTIC_IP>.compute-1.amazonaws.com", 9300));
    FilterBuilder filter = boolFilter()
            .should(termFilter("objectName1.field", fieldValue))
            .should(termFilter("objectName2.field", fieldValue));
    SearchResponse response= client.prepareSearch("indexName")
            .setTypes("type")
            .setPostFilter(filter)
            .setSize(1000)
            .execute()
            .actionGet();
    //other logic

Please let me know if you need me to provide my core-site.xml, hdfs-site.xml, or whatever.

Solved it! In the other logic part, I had "client.close();". Commenting that out resolved my issues.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM