我正在尝试将PostgreSQL
数据库与Logstash
连接起来,以将数据从postgres
导入到elasticsearch
。
我正在使用JDBC驱动程序将Logstash
与postgres
连接起来。
但是我遇到以下错误
[2019-06-27T13:04:05,943] [ERROR] [logstash.javapipeline]一个插件 发生了不可恢复的错误。将重新启动此插件。
Pipeline_id:main插件:“ postgres”,jdbc_password =>,语句=>“ SELECT * FROM public。\“ contacts \”;“,jdbc_driver_library =>” postgresql-42.2.6.jar“, jdbc_connection_string =>“ jd bc:postgresql:// localhost:5432 / LogstashTest”, id =>“ a76a604bb9cb591dd4a19afc95e03873023e008c564101b4ac19aefe30071213”, jdbc_driver_class =>“ org.postgresql.Driver”,enable_metric => true, 编解码器=>“ plain_8f80bf3a-29fe-49e8-86b1-c94e9a298ffb”,enable_metric => true, charset =>“ UTF-8”>,jdbc_paging_enabled => false,jdbc_page_size => 100000, jdbc_validate_connection => false,jdbc_validation_timeout =3600,jdbc_pool_timeout => 5,sql_log_level =>“ info”,connection_retry_attempts => 1, connection_retry_attempts_wait_time => 0.5, 参数=> {“ sql_last_value” => 1970-01-01 00:00:00 UTC}, last_run_metadata_path =>“ C:\ Users \ roshan / .logstash_jdbc_last_run”, use_column_value => false,tracking_column_type =>“数字”, clean_run => false,record_last_run => true,小写字母列名称=> true> 错误:未加载org.postgresql.Driver。确定要包括在内吗 :jdbc_driver_library中正确的jdbc驱动程序?例外: LogStash :: ConfigurationError堆栈: D:/Swares/logstash-7.2.0/logstash-7.2.0/vendor/bundle/jruby/2.5.0/gems/logstash-input-jdbc-4.3.13/lib/logstash/plugin_mixins/jdbc/jdbc.rb :163:in
open_jdbc_connection' D:/Swares/logstash-7.2.0/logstash-7.2.0/vendor/bundle/jruby/2.5.0/gems/logstash-input-jdbc-4.3.13/lib/logstash/plugin_mixins/jdbc/jdbc.rb:221:in
execute_statement' D:/商品/logstash-7.2.0/logstash-7.2.0/vendor/bundle/jruby/2.5.0/gems/logstash-input-jdbc-4.3.13/lib/logstash/inputs/jdbc.rb:277 :在execute_query' D:/Swares/logstash-7.2.0/logstash-7.2.0/vendor/bundle/jruby/2.5.0/gems/logstash-input-jdbc-4.3.13/lib/logstash/inputs/jdbc.rb:263:in
中运行” D:/Swares/logstash-7.2.0/logstash-7.2.0/logstash-core/lib/logstash/java_pipeline.rb:309:ininputworker' D:/Swares/logstash-7.2.0/logstash-7.2.0/logstash-core/lib/logstash/java_pipeline.rb:302:in
阻止start_input' [2019-06-27T13:04:06,946] [错误] [logstash.inputs.jdbc]无法执行 加载postgresql-42.2.6.jar {:exception =>#}
我的配置是
这是我的logstash conf文件
input {
jdbc{
#input configuration
jdbc_driver_library => "postgresql-42.2.6.jar"
jdbc_driver_class => "org.postgresql.Driver"
jdbc_connection_string => "jdbc:postgresql://localhost:5432/LogstashTest"
jdbc_user => "postgres"
jdbc_password => "root"
statement => 'SELECT * FROM public."contacts";'
}
}
output{
stdout { codec => json_lines }
}
答案 0 :(得分:1)
当您将错误的配置文件传递给Logstash时,由于损坏的PostgreSQL JDBC驱动程序可能会出现问题。我遇到了同样的问题,您需要检查JDBC驱动程序文件。