1

I am trying to import a mysql table from mysql server to elasticsearch on my MAC OSX Mavericks.

  1. I have installed elasticsearch 1.3.1 with homebrew
  2. Installed jdbc-river 1.3.0.4 with elasticsearch plugin --install
  3. Installed jdk 1.7.0_67
  4. Downloaded mysql-connector-java-5.1.28-bin.jar into $ES_HOME/plugins/jdbc (I had to create the folders 'plugins' and 'jdbc' myself) and gave chmod 777 permission for the .jar file.
  5. Then I ran ./bin/elasticsearch and called this command in postman in order to create a river:

PUT request.

URL: localhost:9200/_river/my_jdbc_river/_meta

Raw data:

{
    "type" : "jdbc",
    "jdbc" : {
        "url" : "jdbc:mysql://localhost:3306/<databaseName>",
        "user" : "<MysqlUserName>",
        "password" : "<MysqlUserPass",
        "sql" : "select * from <TableName>"
    } 
}

And I received the following error in the elasticsearch log in the terminal:

    [2014-08-26 15:38:39,300][ERROR][org.xbib.elasticsearch.river.jdbc.strategy.simple.SimpleRiverSource] while opening read connection: jdbc:mysql://localhost:3306/xcollector No suitable driver found for jdbc:mysql://localhost:3306/xcollector
java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/xcollector
    at java.sql.DriverManager.getConnection(DriverManager.java:596)
    at java.sql.DriverManager.getConnection(DriverManager.java:215)
    at org.xbib.elasticsearch.river.jdbc.strategy.simple.SimpleRiverSource.getConnectionForReading(SimpleRiverSource.java:196)
    at org.xbib.elasticsearch.river.jdbc.strategy.simple.SimpleRiverSource.execute(SimpleRiverSource.java:315)
    at org.xbib.elasticsearch.river.jdbc.strategy.simple.SimpleRiverSource.fetch(SimpleRiverSource.java:287)
    at org.xbib.elasticsearch.plugin.feeder.jdbc.JDBCFeeder.fetch(JDBCFeeder.java:335)
    at org.xbib.elasticsearch.plugin.feeder.jdbc.JDBCFeeder.executeTask(JDBCFeeder.java:179)
    at org.xbib.elasticsearch.plugin.feeder.AbstractFeeder.newRequest(AbstractFeeder.java:362)
    at org.xbib.elasticsearch.plugin.feeder.AbstractFeeder.newRequest(AbstractFeeder.java:53)
    at org.xbib.pipeline.AbstractPipeline.call(AbstractPipeline.java:87)
    at org.xbib.pipeline.AbstractPipeline.call(AbstractPipeline.java:14)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

I have followed many posts in google to try and find the cause of the problem, does anyone have any idea what I am missing?

And if anyone knows if this procedure can be more automatic to deploy like having some kind of package manager (like npm for node.js).

Thanks in advance,

4

1 回答 1

3

因此,问题的线索是您必须在第 4 步中创建文件夹“plugins”和“jdbc”。这两个文件夹都是在安装 mysql River 插件时创建的。我可以看到您的错误消息中正确安装了 mysql River 插件 - 它正在运行,但无法找到 jdbc 驱动程序。

在您的驱动器上查找正确的文件夹 - $ES_HOME 应该包含以下文件夹:

bin
config
data
lib
logs
plugins

如果没有,则 $ES_HOME 设置不正确。按照指示将您的 jdbc 驱动程序复制到正确的文件夹中,您应该能够解决此问题。

于 2014-08-26T15:08:21.120 回答