2016-08-26 8 views
8

私はElasticsearchでspring-bootを使用しています。プロジェクトはjhipsterを使って作成されました。Spring Elasticsearch - 設定済みのノードがありません

のpom.xmlが含まれています:プロダクションモードで

<parent> 
    <artifactId>spring-boot-starter-parent</artifactId> 
    <groupId>org.springframework.boot</groupId> 
    <version>1.4.0.RELEASE</version> 
    <relativePath/> 
</parent> 

<dependency> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter-data-elasticsearch</artifactId> 
</dependency> 

を、次のエラーが発生します。

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

どのように私はこのエラーを解決することができますか?

+0

デフォルトのelasticsearch設定でjhipsterプロジェクトを実行する場合、jhipster javaプロジェクトがこのバージョンで動作するため、elasticsearhサーバーのバージョンが1.7であることを確認してください。開発プロフィールの – ismail

+0

にはまだ解決できなかったような問題がありました。 – ismail

+0

正常に動作します。ありがとう – Jean

答えて

5

開発プロファイルでは、JHipsterは埋め込み型のElasticsearchを使用します。生産プロファイルで

、それがローカルクラスタに接続するために、デフォルトでしようとするので、あなたのローカルマシン上Elasticsearchをインストールしていないか、既存のクラスタに接続するためにapplication-prod.ymlで右URLを設定していない のいずれか。

0

まずはGaëlMarziouに感謝します。 ローカルマシンにElasticsearchをインストールしましたが、問題は解決しません。これは私のapplication-prod.ymlファイルです。

# =================================================================== 
# Spring Boot configuration for the "prod" profile. 
# 
# This configuration overrides the application.yml file. 
# =================================================================== 

# =================================================================== 
# Standard Spring Boot properties. 
# Full reference is available at: 
# http://docs.spring.io/spring-      
boot/docs/current/reference/html/common-application-properties.html 
# =================================================================== 


spring: 
    devtools: 
     restart: 
     enabled: false 
    livereload: 
     enabled: false 
datasource: 
    type: com.zaxxer.hikari.HikariDataSource 
    url: jdbc:postgresql://localhost:5432/gestor_6_0?useUnicode=true&characterEncoding=utf8&useSSL=false 
    name: 
    username: postgres 
    password: abcdef 
    hikari: 
     data-source-properties: 
      cachePrepStmts: true 
      prepStmtCacheSize: 250 
      prepStmtCacheSqlLimit: 2048 
      useServerPrepStmts: true 
jpa: 
    database-platform: com.everest.gestor.domain.util.FixedPostgreSQL82Dialect 
    database: POSTGRESQL 
    show-sql: false 
    properties: 
     hibernate.cache.use_second_level_cache: true 
     hibernate.cache.use_query_cache: false 
     hibernate.generate_statistics: false 
     hibernate.cache.region.factory_class: org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory 
data: 
    elasticsearch: 
     cluster-name: 
     cluster-nodes: localhost:9300 
mail: 
    host: localhost 
    port: 25 
    username: 
    password: 
thymeleaf: 
    cache: true 

liquibase: 
contexts: prod 

server: 
port: 8080 
compression: 
    enabled: true 
    mime-types: text/html,text/xml,text/plain,text/css, application/javascript, application/json 
    min-response-size: 1024 

# =================================================================== 
# JHipster specific properties 
# =================================================================== 

jhipster: 
http: 
    cache: # Used by the CachingHttpHeadersFilter 
     timeToLiveInDays: 1461 
cache: # Hibernate 2nd level cache, used by CacheConfiguration 
    timeToLiveSeconds: 3600 
    ehcache: 
     maxBytesLocalHeap: 256M 
security: 
    rememberMe: 
     # security key (this key should be unique for your application, and kept secret) 
     key: 33ec72f5b6d07e227df6bcad7ca844c50a40abb1 
mail: # specific JHipster mail property, for standard properties see MailProperties 
    from: [email protected] 
metrics: # DropWizard Metrics configuration, used by MetricsConfiguration 
    jmx.enabled: true 
    spark: 
     enabled: false 
     host: localhost 
     port: 9999 
    graphite: 
     enabled: false 
     host: localhost 
     port: 2003 
     prefix: gestor_6_0 
    logs: # Reports Dropwizard metrics in the logs 
     enabled: false 
     reportFrequency: 60 # in seconds 
logging: 
    logstash: # Forward logs to logstash over a socket, used by LoggingConfiguration 
     enabled: false 
     host: localhost 
     port: 5000 
     queueSize: 512 
+0

はこれが動作していますか? –

+0

今すぐ動作します。感謝。 – Jean

0

ElasticSearchConfiguration.javaでelasticTemplateメソッドを変更しても問題ありません。次の行を追加し、クラスタノード名をElasticsearch 2.0の "Gibborim"に設定します。あなたはデフォルトのelasticsearchの構成でプロジェクトをjhipster実行jhipsterのJavaプロジェクトは、このようなあった開発プロファイルで

(生産プロファイルで)、このバージョンで動作しますので、あなたのelasticsearhサーバーのバージョンが1.7であることを確認してください場合

Settings settings = Settings.settingsBuilder() 
     .put("client.transport.sniff", true).put("name","Gibborim").put("cluster.name", "elasticsearch").put("network.host","127.0.0.1").build(); 

    client = TransportClient.builder().settings(settings).build().addTransportAddress(new InetSocketTransportAddress(new InetSocketAddress("127.0.0.1", 9300))); 
0

私がまだ解決できなかった問題

関連する問題