gpt4 book ai didi

sql-server - 将 Logstash 连接到 SQL Server

转载 作者:行者123 更新时间:2023-12-02 23:57:25 27 4
gpt4 key购买 nike

当我使用配置文件启动 Logstash 时,会出现以下错误。我已经向当前的 jdbc jar 添加了多个类路径。驱动程序类是否已重命名?谢谢

[2018-09-11T11:44:57,241][ERROR][logstash.pipeline        ] A plugin had an unrecoverable error. Will restart this plugin.
Pipeline_id:main
Plugin: <LogStash::Inputs::Jdbc jdbc_connection_string=>"jdbc:sqlserver://localhost:1433/test?useSSL=false&amp;serverTimezone=GMT&amp;DatabaseName=test", jdbc_driver_class=>"com.microsoft.sqlserver.jdbc.SQLServerDriver", jdbc_user=>"test", jdbc_password=><password>, statement=>"SELECT * FROM phones", id=>"d4c77c6d8f243cf0b447d00db3567bad38756544341a7e9fc53c5e611a6cec8d", enable_metric=>true, codec=><LogStash::Codecs::Plain id=>"plain_6b256972-6c6a-481a-87f0-8b587adf7e53", 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, parameters=>{"sql_last_value"=>1970-01-01 01:00:00 +0100}, last_run_metadata_path=>"C:\\Users\\ross.massie/.logstash_jdbc_last_run", use_column_value=>false, tracking_column_type=>"numeric", clean_run=>false, record_last_run=>true, lowercase_column_names=>true>
Error: com.microsoft.sqlserver.jdbc.SQLServerDriver not loaded. :jdbc_driver_library is not set, are you sure you included
the proper driver client libraries in your classpath?
Exception: LogStash::ConfigurationError
Stack: C:/Program Files/logstash-6.3.2/vendor/bundle/jruby/2.3.0/gems/logstash-input-jdbc-4.3.9/lib/logstash/plugin_mixins/jdbc.rb:162:in `open_jdbc_connection'
C:/Program Files/logstash-6.3.2/vendor/bundle/jruby/2.3.0/gems/logstash-input-jdbc-4.3.9/lib/logstash/plugin_mixins/jdbc.rb:220:in `execute_statement'
C:/Program Files/logstash-6.3.2/vendor/bundle/jruby/2.3.0/gems/logstash-input-jdbc-4.3.9/lib/logstash/inputs/jdbc.rb:269:in `execute_query'
C:/Program Files/logstash-6.3.2/vendor/bundle/jruby/2.3.0/gems/logstash-input-jdbc-4.3.9/lib/logstash/inputs/jdbc.rb:255:in `run'
C:/Program Files/logstash-6.3.2/logstash-core/lib/logstash/pipeline.rb:512:in `inputworker'
C:/Program Files/logstash-6.3.2/logstash-core/lib/logstash/pipeline.rb:505:in `block in start_input'

我的配置片段:
input {
jdbc {
jdbc_connection_string => "jdbc:sqlserver://localhost:1433/test?useSSL=false&amp;serverTimezone=GMT&amp;DatabaseName=test"
jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
jdbc_driver_library => "C:\Program Files\logstash-6.3.2\lib\mssql-jdbc-7.0.0.jre8.jar"
jdbc_user => "test"
jdbc_password => "test123"

statement => "SELECT * FROM phones"
}
}

output {
elasticsearch {
hosts => ["localhost:9200"]
index => "phones"
}
}

最佳答案

我只是做了一些自定义的 .NET 编码来完成这项工作,而不是像官方文档建议的那样(很糟糕)将它们连接在一起。

我强烈建议其他人也这样做,以节省我失去的时间。

关于sql-server - 将 Logstash 连接到 SQL Server,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52274293/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com