繁体   English   中英

Logstash:无法将MySQL与Logstash连接?

[英]logstash: not able to connect mysql with logstash?

我正在尝试使用Logstash与MySQL建立连接并在下面的conf文件中的代码中写入弹性搜索

input {
    jdbc {
        jdbc_connection_string => "jdbc:mysql://192.168.2.24:3306/test"
        # The user we wish to execute our statement as
        jdbc_user => "uname"
        jdbc_password => "pass"
        # The path to our downloaded jdbc driver
        jdbc_driver_library => "/usr/local/Cellar/logstash/6.2.4/mysql-connector-java-8.0.11.jar"
        jdbc_driver_class => "com.mysql.jdbc.Driver"
        # our query
        statement => "SELECT * FROM report_table"
    }
}

output {
    elasticsearch {
    action => "index"
    hosts => "localhost:9200"
    index => "mysqlsample"
    document_type => "record"
    }
}

在运行上面得到以下错误:

错误:未加载com.mysql.jdbc.Driver。 您确定在:jdbc_driver_library中包含正确的jdbc驱动程序吗? 异常:LogStash :: ConfigurationError堆栈:/usr/local/Cellar/logstash/6.2.4/libexec/vendor/bundle/jruby/2.3.0/gems/logstash-input-jdbc-4.3.9/lib/logstash/plugin_mixins /jdbc.rb:162:在open_jdbc_connection' /usr/local/Cellar/logstash/6.2.4/libexec/vendor/bundle/jruby/2.3.0/gems/logstash-input-jdbc-4.3.9/lib/logstash/plugin_mixins/jdbc.rb:220:in execute_statement中/usr/local/Cellar/logstash/6.2.4/libexec/vendor/bundle/jruby/2.3.0/gems/logstash-input-jdbc-4.3.9/lib /logstash/inputs/jdbc.rb:264:在execute_query' /usr/local/Cellar/logstash/6.2.4/libexec/vendor/bundle/jruby/2.3.0/gems/logstash-input-jdbc-4.3.9/lib/logstash/inputs/jdbc.rb:250:in运行中/usr/local/Cellar/logstash/6.2.4/libexec/logstash-core/lib/logstash/pipeline.rb:514:在inputworker' /usr/local/Cellar/logstash/6.2.4/libexec/logstash-core/lib/logstash/pipeline.rb:507:in在start_input块中

听起来这是jdbc_driver_library => "/usr/local/Cellar/logstash/6.2.4/mysql-connector-java-8.0.11.jar"

您确定这是有效路径吗? 那是正确的连接器吗? 也许尝试使用文档中提到的一种: mysql-connector-java-5.1.36-bin.jar

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM