簡體   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