2015-10-13 28 views
0

我收到來自Elasticsearch的錯誤。Elasticsearch NoNodeAvailableException

`<html><head><title>Apache Tomcat/7.0.64 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - Request processing failed; nested exception is org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: []</h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u>Request processing failed; nested exception is org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: []</u></p><p><b>description</b> <u>The server encountered an internal error that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [] 
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:943) 
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:822) 
javax.servlet.http.HttpServlet.service(HttpServlet.java:624) 
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:807) 
javax.servlet.http.HttpServlet.service(HttpServlet.java:731) 
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 
myapp.filter.SimpleCORSFilter.doFilter(SimpleCORSFilter.java:22) 
</pre></p><p><b>root cause</b> <pre>org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [] 
org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:305) 
org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:200) 
org.elasticsearch.client.transport.support.InternalTransportIndicesAdminClient.execute(InternalTransportIndicesAdminClient.java:86) 
org.elasticsearch.client.support.AbstractIndicesAdminClient.exists(AbstractIndicesAdminClient.java:178) 
org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequestBuilder.doExecute(IndicesExistsRequestBuilder.java:53) 
org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:91) 
org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:65) 
myapp.dao.CommonDao.ValidateTenant(CommonDao.java:7) 
myapp.dao.CliffDomainDao.viewCliffDomains(CliffDomainDao.java:55) 
myapp.service.CliffDomainService.getall(CliffDomainService.java:53) 
myapp.controller.CliffDomainController.getall(CliffDomainController.java:79) 
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
java.lang.reflect.Method.invoke(Method.java:497) 
org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:214) 
org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) 
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) 
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:748) 
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:689) 
org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83) 
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:945) 
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876) 
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:931) 
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:822) 
javax.servlet.http.HttpServlet.service(HttpServlet.java:624) 
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:807) 
javax.servlet.http.HttpServlet.service(HttpServlet.java:731) 
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 
myapp.filter.SimpleCORSFilter.doFilter(SimpleCORSFilter.java:22) 
</pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the Apache Tomcat/7.0.64 logs.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.64</h3></body></html>` 

我在Ubuntu上運行Elasticsearch 1.7.2。

的變化,我在elasticsearch.yml取得

################################### Cluster ################################### 

# Cluster name identifies your cluster for auto-discovery. If you're running 
# multiple clusters on the same network, make sure you're using unique names. 
# 
cluster.name: cliffservice 




# Set the address other nodes will use to communicate with this node. If not 
# set, it is automatically derived. It must point to an actual IP address. 
# 
#network.publish_host: 192.168.0.1 
network.publish_host: 10.100.10.231 
# Set both 'bind_host' and 'publish_host': 
# 
#network.host: 192.168.0.1 

連接代碼

public TransportClient getClient() { 
    Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name", "cliffservice").build(); 
    TransportClient client = new TransportClient(settings); 
    client = client.addTransportAddress(new InetSocketTransportAddress(this.host, this.port)); 

    this.esclient = client; 

    return client; 
} 

得到彈性客戶數據

SearchResponse response = Connection.getEsclient().prepareSearch("testindex").setTypes("testtype").execute() 
       .actionGet(); 

     if (response.getHits().getHits().length > 0) { 
      for (SearchHit hit : response.getHits().getHits()) { 
       CliffDomain cliffDomain = new CliffDomain(); 

       assetDomain.setCliffDomainId(hit.getId()); 
       assetDomain.setCliffDomainName((String) hit.sourceAsMap().get("clifftDomainName")); 

       searchResponse.add(cliffDomain); 

      } 
     } 

我做錯了什麼?

回答

0

最後我想出了問題。我在我的Java應用程序中使用了elasticsearch-1.7.1。在我的本地計算機Elasticsearch-1.7.1被安裝,但在服務器中elasticsearch的版本是1.7.2。這是問題所在。我將服務器的elasticsearch降級到1.7.1,現在工作正常。

+0

這應該不是一個問題。傳輸客戶端應該與主版本中的任何服務器兼容。換句話說,任何1.X.Y客戶端都應該能夠連接到任何1.A.B服務器。我只是用1.7.1和1.7.2進行了測試,一切正常。所以,我懷疑這是某種配置問題。 – imotov

+0

但是相信我這是我改變的唯一的東西。我沒有改變我的代碼中的任何東西,只是停止elasticsearch 1.7.2並開始1.7.1'cluster.name'作爲'cliffservice'並開始工作。 – user3306669

+0

你能重現嗎? – imotov

1

您的客戶和服務處於不同的羣集中。客戶端位於assetservice,服務器位於cliffservice。另外,請確保客戶端可以連接到10.100.10.231的端口9300。

+0

我將代碼'assetservice'更改爲'cliffservice'仍然有相同的錯誤。這在我的本地計算機上運行良好,但是當我將它上傳到ubuntu服務器時,出現相同的錯誤。 9200&9300端口在服務器上打開。 – user3306669

+0

你可以在客戶機上運行'curl 10.100.10.231:9200'嗎?你有沒有嘗試打印出來,並仔細檢查客戶端上的連接主機和端口? – imotov

+0

我試圖 '遠程登錄本地主機9200'使用膩子 回覆是 '根@懸崖DEV1:〜#遠程登錄本地主機9200' '嘗試127.0.0.1 ...'' 連接到localhost.' '逃生字符是'^]'。' – user3306669