Spring Elasticsearch - None of the configured nodes are available
In development profile, JHipster uses an embedded Elasticsearch.
In production profile, it tries by default to connect to a local cluster, so either you don't have installed Elasticsearch on your local machine or youhaven't configured the right URL in application-prod.yml
to connect to an existing cluster.
First of all thanks Gaƫl Marziou. I installed Elasticsearch on my local machine but the problem persist. So, this is my application-prod.yml file.
# ===================================================================# 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: falsedatasource: 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: truejpa: 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.SingletonEhCacheRegionFactorydata: elasticsearch: cluster-name: cluster-nodes: localhost:9300mail: host: localhost port: 25 username: password:thymeleaf: cache: trueliquibase:contexts: prodserver:port: 8080compression: 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: 1461cache: # Hibernate 2nd level cache, used by CacheConfiguration timeToLiveSeconds: 3600 ehcache: maxBytesLocalHeap: 256Msecurity: rememberMe: # security key (this key should be unique for your application, and kept secret) key: 33ec72f5b6d07e227df6bcad7ca844c50a40abb1mail: # specific JHipster mail property, for standard properties see MailProperties from: gestor_6_0@localhostmetrics: # 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 secondslogging: logstash: # Forward logs to logstash over a socket, used by LoggingConfiguration enabled: false host: localhost port: 5000 queueSize: 512
I change my elasticTemplate method in ElasticSearchConfiguration.java and works fine. I just add the follow lines and set my cluster node name to "Gibborim" in Elasticsearch 2.0.
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)));