MYSQL的{Logstash Jdbc输入插件

时间:2015-07-24 12:58:50

标签: jdbc logstash

我在Windows中使用Logstash。我无法安装输入jdbc插件,所以我手动下载了zip文件,并将logstash文件夹从插件放入我的logstash-1.5.2文件夹。 文件夹结构 - " D:\ elastic search \ logstash-1.5.2 \ lib \ logstash \ inputs \ jdbc.rb"。

我的配置文件

input {
   jdbc {
     jdbc_driver_library => "D:/elastic search/logstash-1.5.2/lib/mysql-connector-java-5.1.13-bin.jar"
     jdbc_driver_class => "com.mysql.jdbc.Driver"
     jdbc_connection_string => "jdbc:mysql://localhost:3306/test"
     jdbc_user => "root"
    jdbc_password => ""
    statement => "SELECT * from data"
    jdbc_paging_enabled => "true"
    jdbc_page_size => "50000"
   }
 }

output {  
stdout { codec => rubydebug }
    elasticsearch { 
       embedded => true
       index => "bike"
       type => "bikeapp"
       cluster =>"trailcluster"
        protocol => "http"
       port => "9200"

    }
}

当我运行logstash时出现错误

D:\elastic search\logstash-1.5.2\bin>logstash -f logtest.conf
io/console not supported; tty will not be manipulated
←[33mjdbc plugin doesn't have a version. This plugin isn't well
 supported by the community and likely has no maintainer. {:level=>:warn}←[0m
←[33mYou are using a deprecated config setting "type" set in elasticsearch. Deprecated settings will continue to work, but are scheduled for removal from logstash in the future. You can achieve this same behavior with the new
 conditionals, like: `if [type] == "sometype" { elasticsearch { ... } }`. If you have any questions about this, please visit the #logstash channel on freenode irc. {:name=>"type", :plugin=><LogStash::Outputs::ElasticSearch --
->, :level=>:warn}←[0m
LoadError: no such file to load -- sequel
                  require at org/jruby/RubyKernel.java:1072
                  require at D:/elastic search/logstash-1.5.2/vendor/bundle/jruby/1.9/gems/polyglot-0.3.5/lib/polyglot.rb:65
  prepare_jdbc_connection at D:/elastic search/logstash-1.5.2/lib/logstash/plugin_mixins/jdbc.rb:65
                 register at D:/elastic search/logstash-1.5.2/lib/logstash/inputs/jdbc.rb:144
             start_inputs at D:/elastic search/logstash-1.5.2/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.2.2-java/lib/logstash/pipeline.rb:148
                     each at org/jruby/RubyArray.java:1613
             start_inputs at D:/elastic search/logstash-1.5.2/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.2.2-java/lib/logstash/pipeline.rb:147
                      run at D:/elastic search/logstash-1.5.2/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.2.2-java/lib/logstash/pipeline.rb:80
              synchronize at org/jruby/ext/thread/Mutex.java:149
                      run at D:/elastic search/logstash-1.5.2/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.2.2-java/lib/logstash/pipeline.rb:80
                  execute at D:/elastic search/logstash-1.5.2/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.2.2-java/lib/logstash/agent.rb:150
                      run at D:/elastic search/logstash-1.5.2/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.2.2-java/lib/logstash/runner.rb:91
                     call at org/jruby/RubyProc.java:271
                      run at D:/elastic search/logstash-1.5.2/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.2.2-java/lib/logstash/runner.rb:96
                     call at org/jruby/RubyProc.java:271
               initialize at D:/elastic search/logstash-1.5.2/vendor/bundle/jruby/1.9/gems/stud-0.0.20/lib/stud/task.rb:12

1 个答案:

答案 0 :(得分:0)

将Jar文件添加到Plugin fodler后,您只需转到CMD Prompt中的文件夹路径,然后使用以下命令安装插件以进行logstash

在已安装的Logstash中运行:

构建你的插件gem

gem build logstash-input-jdbc.gemspec

从Logstash主页安装插件

bin/plugin install /your/local/plugin/logstash-input-jdbc.gem

最后,您将启动Logstash并继续使用您正在使用的配置测试插件....