jprante / elasticsearch-jdbc

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

No client #675

Open nheinbaugh opened 9 years ago

nheinbaugh commented 9 years ago

Hey guys,

I am trying to move data from a single table in a MySQL database into ES, and I just can't make it work. I've followed your tutorials and checked the forums to no avail. Here is the current setup:

Here is my bash script that should kick it all off

 #!/bin/sh

echo '
{
    "type" : "jdbc",
    "jdbc" : {
        "url" : "jdbc:mysql://1.1.1.1:3600/db_name,
        "user" : "B",
        "password" : "passwordHere",
        "sql" : "select * from VIEWNAME limit 1000",
        "index" : "importer",
        "type" : "test"
}
}
' | java \
    -cp "/es-jdbc/lib/*" \
    -Dlog4j.configurationFile=/es-jdbc/bin/log4j2.xml \
    org.xbib.tools.Runner \
    org.xbib.tools.JDBCImporter 

For starters I was getting a bad substitution error on the bash so I just got rid of the local vars and hardcoded the file location as needed in the java part (is that the problem?)

In the log file I am getting this:

[22:44:38,634][INFO ][importer.jdbc            ][main] index name = importer, concrete index name = importer
[22:44:38,645][INFO ][importer.jdbc            ][pool-2-thread-1] strategy standard: settings = {password=password, type=test, user=name, index=importer, sql=select * from VIEWNAME limit 1000, url=jdbc:mysql://11.1.17:3306/dbname}, context = org.xbib.elasticsearch.jdbc.strategy.standard.StandardContext@54c5d054
[22:44:38,646][INFO ][importer.jdbc.context.standard][pool-2-thread-1] found sink class org.xbib.elasticsearch.jdbc.strategy.standard.StandardSink@6013910f
[22:44:38,653][INFO ][importer.jdbc.context.standard][pool-2-thread-1] found source class org.xbib.elasticsearch.jdbc.strategy.standard.StandardSource@295dccc3
[22:44:38,682][INFO ][BaseTransportClient      ][pool-2-thread-1] creating transport client, java version 1.8.0_66-internal, effective settings {cluster.name=elasticsearch, port=9300, sniff=false, autodiscover=false, name=importer, client.transport.ignore_cluster_name=false, client.transport.ping_timeout=5s, client.transport.nodes_sampler_interval=5s}
[22:44:38,708][INFO ][org.elasticsearch.plugins][pool-2-thread-1] [importer] loaded [support-1.7.2.1-a140d30], sites []
[22:44:39,102][INFO ][BaseTransportClient      ][pool-2-thread-1] trying to connect to [inet[localhost/127.0.0.1:9300]]
[22:44:39,233][INFO ][BaseTransportClient      ][pool-2-thread-1] connected to [[Robert da Costa][VdY7Th18SN6_PaAh0yprNw][44494513a3a1][inet[localhost/127.0.0.1:9300]]]
[22:44:41,535][WARN ][BulkTransportClient      ][Thread-1] no client

It isn't timing out, or giving me any indication that it isn't connecting properly. I verified that I have the correct version of ES for the JDBC that we are using. I updated the jar file in the /lib folder to contain the following:

derby-10.11.1.1.jar
h2-1.4.181.jar
jdbc-driver-csv-1.0.0.jar
mysql-connector-java-5.1.33.jar
postgresql-9.3-1102-jdbc41.jar elasticsearch-jdbc-1.7.2.1-uberjar.jar
hsqldb-2.3.2.jar
mysql-connector-java-5.1.32.jar
mysql-connector-java-debian.jar

What should my next steps be? I can't find anything wrong in the setup thus far.

Thank you for your assistance.

Nick

jprante commented 9 years ago

It should work if you add a definition for the Elasticsearch cluster to connect to

{
    "type" : "jdbc",
    "jdbc" : {
        "url" : "jdbc:mysql://1.1.1.1:3600/db_name,
        "user" : "B",
        "password" : "passwordHere",
        "sql" : "select * from VIEWNAME limit 1000",
        "index" : "importer",
        "type" : "test",
        "elasticsearch" : {
               "cluster" : "elasticsearch",
               "host" : "localhost",
               "port" : 9300
        }
    }
}

There is a glitch in the current version that skips over the host parameter, so this may be the reason, I'm not sure.

jprante commented 9 years ago

I have created JDBC importer 1.7.3.0 for ES 1.7.3, maybe you can give it a try?