2017-05-31 7 views
2

で失敗します。Elasticsearchは、私はこのようなelasticsearchイメージを実行していますNoNodeAvailableException

curl http://127.0.0.1:9200/_cluster/health 

応答:アプリケーションで

{"cluster_name":"elasticsearch","status":"green","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":0,"active_shards":0,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":0,"delayed_unassigned_shards":0,"number_of_pending_tasks":0,"number_of_in_flight_fetch":0,"task_max_waiting_in_queue_millis":0,"active_shards_percent_as_number":100.0} 

私はこのようなのtransportClientを設定します。

@Bean(destroyMethod = "close") 
    public TransportClient transportClient() throws UnknownHostException { 
     return new PreBuiltTransportClient(Settings.EMPTY) 
       .addTransportAddress(new InetSocketTransportAddress(
         InetAddress.getByName("localhost"), 9300)); 
    } 

そして、私はそれを確認したい:

@Autowired 
private TransportClient client; 
@GetMapping(value = "test") 
    public Object test(){ 
     return client.admin().cluster().health(Requests 
       .clusterHealthRequest()) 
       .actionGet(); 
    } 

が、それはで失敗例外:

org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [{#transport#-1}{_atMOwK5R5mgOXqAPJWvWg}{localhost}{127.0.0.1:9300}] 

ところで、私はこの依存関係を使用しています:これはあなたのコンテナ名であるため、代わりにローカルホストのcompile('org.elasticsearch.client:transport:5.4.0')

+0

で実行されている春のブートアプリが同じような状況を持っています/ error(grailsクライアント、docker-compose + es 5.3)。その間あなたはそれを解決しましたか? –

答えて

0

はelasticsearchを与えることをしようと、ケースにもドッキングウィンドウ

+0

スプリングブーツがドッカーの外にあります。 InetAddress.getByName( "elasticsearch")、9300)がUnknownHostExceptionにつながる:elasticsearch:名前またはサービスが知られていない –

+0

ブラウザーからhttp://127.0.0.1:9200/_cluster/health –

+0

はいの応答を得ることができました。フォームカールと同じ –

関連する問題