-1

i started a project using JHipster and elasticsearch and i don't know how configure my project to connect with distant elk server.

I have a distant elasticsearch on 10.119.19.28:9200, when I enter the address to browser I got this:

{
  "name" : "Home",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "groSpqBZRbW9BtTCW3S4Dg",
  "version" : {
    "number" : "7.1.0",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "606a173",
    "build_date" : "2019-05-16T00:43:15.323135Z",
    "build_snapshot" : false,
    "lucene_version" : "8.0.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

And I have 2 java property in my backend:

data:
  elasticsearch:
    cluster-name: elasticsearch
    cluster-nodes: 10.119.19.28:9200

When I try to run my app I get this error:

java.lang.IllegalStateException: handshake failed with {127.0.0.1:9300}{dx8H800uTceGEL6zDPrGNg}{127.0.0.1}{127.0.0.1:9300}
    at org.elasticsearch.transport.TransportService.handshake(TransportService.java:400)
    at org.elasticsearch.transport.TransportService.handshake(TransportService.java:367)
    at org.elasticsearch.discovery.zen.UnicastZenPing$PingingRound.getOrConnect(UnicastZenPing.java:366)
    at org.elasticsearch.discovery.zen.UnicastZenPing$3.doRun(UnicastZenPing.java:471)
    at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:723)
    at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.elasticsearch.transport.NodeDisconnectedException: [][127.0.0.1:9300][internal:transport/handshake] disconnected

How to connect to this elastic 7.1.0 server with my Jhipster backend?

MQD haitam
  • 19
  • 1

3 Answers3

2

Set spring.data.jest.* properties in your application-*.yml file

This is not specific to JHipster, see Spring Boot documentation about application properties: https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html

Gaël Marziou
  • 16,028
  • 4
  • 38
  • 49
  • when i execute my jhipster project i have this error : java.lang.IllegalStateException: handshake failed with {127.0.0.1:9300}{Ieus9c3eTyqqBPjDjZPYnQ}{127.0.0.1}{127.0.0.1:9300} – MQD haitam Jul 26 '19 at 08:04
  • Please edit your question to add full error and configuration in application_*.yml related to elasticsearch. – Gaël Marziou Jul 26 '19 at 11:25
1

You should define the remote elasticsearch instance in elasticsearch.yml

The content of this file has already placeholders for this. Just fill-in the right domain name or IP-address and remove the comment "#"

# By default Elasticsearch is only accessible on localhost. Set a different
# address here to expose this node on the network:
#
#network.host: 127.0.0.1
#
# By default Elasticsearch listens for HTTP traffic on the first free port it
# finds starting at 9200. Set a specific HTTP port here:
#
#http.port: 9200
Luc
  • 223
  • 2
  • 13
0

i think you should have something like this in your configuration in application_*.yml :

spring:
  devtools:
    ....
  datasource:
    ....
    ....
  data:
    jest:
      uri: http://10.119.19.28:9200
  elasticsearch:
    rest:
      uris: http://10.119.19.28:9200
ZINE Mahmoud
  • 1,272
  • 1
  • 17
  • 32