Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v5 connect panic: no Elasticsearch node available #387

Closed
zplzpl opened this issue Nov 9, 2016 · 16 comments
Closed

v5 connect panic: no Elasticsearch node available #387

zplzpl opened this issue Nov 9, 2016 · 16 comments

Comments

@zplzpl
Copy link

zplzpl commented Nov 9, 2016

Please use the following questions as a guideline to help me answer
your issue/question without further inquiry. Thank you.

Which version of Elastic are you using?

[ ] elastic.v5 (for Elasticsearch 5.x)

Please describe the expected behavior

panic: no Elasticsearch node available

Please describe the actual behavior


	// Create a client
	client, err := elastic.NewClient(elastic.SetURL("http://192.168.33.10:9200"))
	if err != nil {
		panic(err)
	}

curl -s -XGET 'http://192.168.33.10:9200/_nodes/http?pretty=1'
{
  "_nodes" : {
    "total" : 1,
    "successful" : 1,
    "failed" : 0
  },
  "cluster_name" : "es-search",
  "nodes" : {
    "qoa_gnFlTtSPjUiQWH_I9g" : {
      "name" : "node-1",
      "transport_address" : "10.0.2.15:9300",
      "host" : "10.0.2.15",
      "ip" : "10.0.2.15",
      "version" : "5.0.0",
      "build_hash" : "253032b",
      "roles" : [
        "master",
        "data",
        "ingest"
      ],
      "http" : {
        "bound_address" : [
          "[::]:9200"
        ],
        "publish_address" : "10.0.2.15:9200",
        "max_content_length_in_bytes" : 104857600
      }
    }
  }
}

Any steps to reproduce the behavior?

Run the code above

@olivere
Copy link
Owner

olivere commented Nov 9, 2016

One word: Sniffing. The client will try to find other nodes in the cluster by default (as all official Elasticsearch clients do). It will do so by finding the publish_address in the response you sent. Can you ping 10.0.2.15:9200 from your node?

Either disable sniffing (elastic.SetSniff(false)) or make sure all ES nodes return an address that is accessible by your application.

@kuma-guy
Copy link

kuma-guy commented Mar 9, 2017

I followed Connection-Problems on Wiki, but still get "no Elasticsearch node available"

Which version of Elastic are you using?

  • elastic.v5 (for Elasticsearch 5.x)

Please describe the expected behavior

panic: no Elasticsearch node available

Please describe the actual behavior

// Create a client
i.ElasticClient, err = elastic.NewClient(elastic.SetSniff(false), elastic.SetURL("http://127.0.0.1:9200"))
if err != nil {
    // Handle error
    panic(err)
}
curl -s -XGET 'http://127.0.0.1:9200/_nodes/http?pretty=1'
{
  "_nodes" : {
    "total" : 1,
    "successful" : 1,
    "failed" : 0
  },
  "cluster_name" : "elasticsearch_kumaguy",
  "nodes" : {
    "FBkUSwVqSNG0lIFnBcVAww" : {
      "name" : "FBkUSwV",
      "transport_address" : "127.0.0.1:9300",
      "host" : "127.0.0.1",
      "ip" : "127.0.0.1",
      "version" : "5.2.2",
      "build_hash" : "f9d9b74",
      "roles" : [
        "master",
        "data",
        "ingest"
      ],
      "http" : {
        "bound_address" : [
          "[fe80::1]:9200",
          "[::1]:9200",
          "127.0.0.1:9200"
        ],
        "publish_address" : "127.0.0.1:9200",
        "max_content_length_in_bytes" : 104857600
      }
    }
  }
}
{
  "name" : "FBkUSwV",
  "cluster_name" : "elasticsearch_kumaguy",
  "cluster_uuid" : "1tc7ObqOTIKg0LbYauf2pw",
  "version" : {
    "number" : "5.2.2",
    "build_hash" : "f9d9b74",
    "build_date" : "2017-02-24T17:26:45.835Z",
    "build_snapshot" : false,
    "lucene_version" : "6.4.1"
  },
  "tagline" : "You Know, for Search"
}

Any steps to reproduce the behavior?

Run the code above

@olivere
Copy link
Owner

olivere commented Mar 9, 2017

Works fine here.

I set up an example here a few months ago: https://gist.github.com/olivere/d49cae8646122d163103e4c12cc2d66a. That works fine here.

You need to make sure that the server (the part which runs the Elastic code) can connect to 127.0.0.1:9200. That's all that's required.

@olivere
Copy link
Owner

olivere commented Mar 9, 2017

I also added a simple connect example.

$ ./connect -h
Usage of ./connect:
  -sniff
    	Enable or disable sniffing (default true)
  -url string
    	Elasticsearch URL (default "http://localhost:9200")

$ ./connect -sniff=true
Connection succeeded

$ ./connect -sniff=false
Connection succeeded

@kuma-guy
Copy link

kuma-guy commented Mar 9, 2017

Thanks for quick response.

I tested your example and simple connect.
Both totally works fine here too...

Do I need something if it works on top of Google App Engine?

@olivere
Copy link
Owner

olivere commented Mar 9, 2017

@kuma-guy There's a wiki page for that.

@kuma-guy
Copy link

kuma-guy commented Mar 9, 2017

@olivere it works! sorry for taking your time and thanks for your help!

@478682649
Copy link

elastic.SetSniff(false)

@olivere
Copy link
Owner

olivere commented Jan 24, 2018

@478682649 Thinking of making this the official slogan of the library: "elastic.SetSniff(false) is a Go library for Elasticsearch" ;-)

@ZChristine
Copy link

I try to use the following command to have a quick start of carley
cayley.exe http -a ./data/disease_crawled_6212.nq -d elastic http://10.190.188.45:9200
but it return a error of "health check timeout: no Elasticsearch node available" @olivere

@olivere
Copy link
Owner

olivere commented Aug 1, 2018

@ZChristine You can disable health checks alongside with sniffing. Something like this:

client, err := elastic.NewClient(...,
   elastic.SetSniff(false),
   elastic.SetHealthcheck(false),
   ...
)

If you want to know how to configure Elasticsearch in a way that you don't need to do this, see https://github.com/olivere/elastic-with-docker.

@olivere
Copy link
Owner

olivere commented Aug 1, 2018

@ZChristine Maybe this is an issue for Cayley, as they don't seem to support passing parameters into Elastic.

I wonder if they could use the github.com/olivere/elastic/config package to make Elastic automatically pick up connection parameters from the URL. It's up to the authors of Cayley though.

@ZChristine
Copy link

thanks for timely replying . I got the wrong way of command prompt before , and I fixed it later. And download the nq file into local elastic . But the loading speed is pretty slow, was this because of the way that es storage the data from cayley ? If the data was like triple model, what does it look like in es?

@olivere
Copy link
Owner

olivere commented Aug 3, 2018

Elasticsearch Bulk API is pretty fast. It depends on various factors though, e.g. the size of the documents or the I/O of the cluster. You should really talk to the authors of Cayley for those things.

BTW I opened cayleygraph/cayley#730 to address the original issue you mentioned.

@ZChristine
Copy link

thanks so much

@li-keli
Copy link

li-keli commented Oct 22, 2019

I have the same problem, I added elastic.SetSniff(false) solved this problem
thanks so much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants