jprante / elasticsearch-jdbc

JDBC importer for Elasticsearch
Apache License 2.0
2.84k stars 710 forks source link

org.elasticsearch.client.transport.NoNodeAvailableException: no cluster nodes available #968

Open yuanhr opened 6 years ago

yuanhr commented 6 years ago

hello~ my elasticsearch version is 1.6.0 and jdbc version is 1.6.0.1 I have an issue with the JDBC importer version 1.6.0.1

I try to import data from a mysql table like this:

!/bin/sh

2 JDBC_IMPORTER_HOME=/usr/elasticsearch-jdbc-1.6.0.1 3 bin=$JDBC_IMPORTER_HOME/bin 4 lib=$JDBC_IMPORTER_HOME/lib 5 echo '{ 6 "type" : "jdbc", 7 "jdbc": { 8 "url": "jdbc:mysql://ubuntu8:3306/twitter_chinese_326", 9 "user": "root", 10 "password": "", 11 "sql": "select from chinese_info_sc", 12 "max_retries_wait" : "100s", 13 "query_timeout" : 2000, 14 "elasticsearch" : { 15 "autodiscover" : false, 16 "cluster" : "elasticsearch-xnr", 17 "host" : "ubuntu8", 18 "port" : 9205 19 }, 20 "index" : "twitter_user", 21 "type" : "user" 22 } 23 }'| java \ 24 -cp "${lib}/" \ 25 -Dlog4j.configurationFile=${bin}/log4j2.xml \ 26 org.xbib.tools.Runner \ 27 org.xbib.tools.JDBCImporter

Unexpectedly, I got the following error.

org.elasticsearch.client.transport.NoNodeAvailableException: no cluster nodes available, check settings {cluster.name=elasticsearch-xnr, host.0=❯ 568 ▸---at org.xbib.elasticsearch.support.client.BaseTransportClient.createClient(BaseTransportClient.java:52) ~[elasticsearch-jdbc-1.6.0.1-uberjar.❯ 569 ▸---at org.xbib.elasticsearch.support.client.BaseIngestTransportClient.newClient(BaseIngestTransportClient.java:22) ~[elasticsearch-jdbc-1.6.0.1❯ 570 ▸---at org.xbib.elasticsearch.support.client.transport.BulkTransportClient.newClient(BulkTransportClient.java:88) ~[elasticsearch-jdbc-1.6.0.1-u❯ 571 ▸---at org.xbib.elasticsearch.jdbc.strategy.standard.StandardContext$1.create(StandardContext.java:440) ~[elasticsearch-jdbc-1.6.0.1-uberjar.jar❯ 572 ▸---at org.xbib.elasticsearch.jdbc.strategy.standard.StandardSink.beforeFetch(StandardSink.java:94) ~[elasticsearch-jdbc-1.6.0.1-uberjar.jar:?] 573 ▸---at org.xbib.elasticsearch.jdbc.strategy.standard.StandardContext.beforeFetch(StandardContext.java:207) ~[elasticsearch-jdbc-1.6.0.1-uberjar.❯ 574 ▸---at org.xbib.elasticsearch.jdbc.strategy.standard.StandardContext.execute(StandardContext.java:188) ~[elasticsearch-jdbc-1.6.0.1-uberjar.jar:❯ 575 ▸---at org.xbib.tools.JDBCImporter.process(JDBCImporter.java:117) ~[elasticsearch-jdbc-1.6.0.1-uberjar.jar:?] 576 ▸---at org.xbib.tools.Importer.newRequest(Importer.java:241) [elasticsearch-jdbc-1.6.0.1-uberjar.jar:?] 577 ▸---at org.xbib.tools.Importer.newRequest(Importer.java:57) [elasticsearch-jdbc-1.6.0.1-uberjar.jar:?] 578 ▸---at org.xbib.pipeline.AbstractPipeline.call(AbstractPipeline.java:86) [elasticsearch-jdbc-1.6.0.1-uberjar.jar:?] 579 ▸---at org.xbib.pipeline.AbstractPipeline.call(AbstractPipeline.java:17) [elasticsearch-jdbc-1.6.0.1-uberjar.jar:?] 580 ▸---at java.util.concurrent.FutureTask.run(FutureTask.java:262) [?:1.7.0_79] 581 ▸---at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [?:1.7.0_79] 582 ▸---at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [?:1.7.0_79] 583 ▸---at java.lang.Thread.run(Thread.java:745) [?:1.7.0_79] 584 [17:03:35,616][WARN ][BulkTransportClient ][Thread-1] no client

but cluster name has no problem, the localhost has no problem, too.

So I wonder why JDBC finds no cluster nodes available.

Looking forward to your reply!

Thanks!

harisuperman commented 6 years ago

"jdbc" : { **"cluster.name" : "myCluster",** "url" : "jdbc:mysql://localhost:3306/article_spider", "statefile" : "statefile.json", "schedule" : "0 0-59 0-23 ? * *", "user" : "root", "password" : "123456", "sql" : [{ "statement": "select * from jobbole_article", "parameter": ["publish", "$metrics.lastexecutionstart"]} ], "index" : "jobbole", "type" : "content-type", "metrics": { "enabled" : true }, "elasticsearch" : { "cluster" : "elasticsearch", "host" : "localhost", "port" : 9300 } } i think you losted this -> "cluster.name" : "myCluster", you need defin cluster name