【问题标题】:JDBC MSSQL with Logsatsh to connect to Montoring DB带有 Logstash 的 JDBC MSSQL 以连接到监控数据库
【发布时间】:2020-01-08 07:53:55
【问题描述】:

我已经安装了 logsatsh 7.2,我正在尝试配置从 Solarwinds DB 获取数据。 我正在使用以下 Logstash 配置:

    input {
    jdbc {
        jdbc_connection_string => "jdbc:sqlserver://SOLARWINS:5674;databasename=Orion_DB;integratedSecurity=true"
        jdbc_driver_class =>  "com.microsoft.sqlserver.jdbc.SQLServerDriver"
        jdbc_driver_library => "/etc/logstash/mssql-jdbc-7.4.1.jre8.jar"
        jdbc_user => "logstash"
        jdbc_password => "pass123"
        statement => "SELECT * from events"
    }
}
output {
          elasticsearch { hosts => ["10.26.67.29:9200"]
                index => "swdata"
          }
          stdout { codec => rubydebug }
       }

我收到一条错误消息:

[2020-01-08T01:57:19,264][ERROR][logstash.inputs.jdbc     ] Unable to connect to database. Tried 1 times {:error_message=>"Java::ComMicrosoftSqlserverJdbc::SQLServerException: This driver is not configured for integrated authentication. ClientConnectionId:ef93944c-9f83-44d3-a370-254903b671ef"}
[2020-01-08T01:57:19,265][ERROR][logstash.javapipeline    ] A plugin had an unrecoverable error. Will restart this plugin.
  Pipeline_id:sw
  Plugin: <LogStash::Inputs::Jdbc jdbc_user=>"sa_logstash", jdbc_password=><password>, statement=>"SELECT * from events", jdbc_driver_library=>"/etc/logstash/mssql-jdbc-7.4.1.jre8.jar", jdbc_connection_string=>"jdbc:sqlserver://SOLARWINS:5674;databasename=Orion_DB;integratedSecurity=true", id=>"3c6c347831ec1a9a964da106925ef193a86d1d52adf190f9bd046d6b408e3e2b", jdbc_driver_class=>"com.microsoft.sqlserver.jdbc.SQLServerDriver", enable_metric=>true, codec=><LogStash::Codecs::Plain id=>"plain_52f36adf-96b9-44a1-8e8c-40b2f009ebd2", 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"=>2020-01-07 12:18:53 UTC}, last_run_metadata_path=>"/usr/share/logstash/.logstash_jdbc_last_run", use_column_value=>false, tracking_column_type=>"numeric", clean_run=>false, record_last_run=>true, lowercase_column_names=>true>
  Error: Java::ComMicrosoftSqlserverJdbc::SQLServerException: This driver is not configured for integrated authentication. ClientConnectionId:ef93944c-9f83-44d3-a370-254903b671ef
  Exception: Sequel::DatabaseConnectionError

现在, 我的 Solarwinds 在 Windows 中,而我的 Logstash 在 Linux 中。我看到这可能是一个潜在的问题。 但我不完全明白我能做些什么。

我需要在配置文件中进行哪些更改才能启用连接?

更新: 我将连接字符串更改为

 jdbc_connection_string => "jdbc:sqlserver://STRPROAG01:32452;databasename=Orion_DB;integratedSecurity=true;authenticationScheme=JavaKerberos"

新的错误日志:

[2020-01-08T04:36:56,186][ERROR][logstash.inputs.jdbc     ] Unable to connect to database. Tried 1 times 
{:error_message=>"Java::ComMicrosoftSqlserverJdbc::SQLServerException: Integrated authentication failed. ClientConnectionId:dd8a0cae-cbc1-4a8b-94aa-a3186e810e94"}
    [2020-01-08T04:36:56,189][ERROR][logstash.javapipeline    ] ntAuthInit(com/microsoft/sqlserver/jdbc/KerbAuthentication.java:125)

【问题讨论】:

    标签: sql-server jdbc logstash elastic-stack mssql-jdbc


    【解决方案1】:

    根据 JDBC Sql 连接文档,您可以尝试提供用户名和 连接字符串查询中的密码如下图:

    jdbc:sqlserver://servername=server_name;integratedSecurity=true;authenticationScheme=JavaKerberos;userName=****;password=****
    
    Please refer the doc :
    

    https://docs.microsoft.com/en-us/sql/connect/jdbc/using-kerberos-integrated-authentication-to-connect-to-sql-server?view=sql-server-ver15

    please try and let me know , if the issue still persists.
    
    Thanks.
    

    【讨论】:

    • 问题仍然存在。但是,我将集成安全设置为 false,只允许 SQL 身份验证,没有 Windows/Kerberos 级别的身份验证。
    猜你喜欢
    • 1970-01-01
    • 2012-12-12
    • 2021-05-13
    • 1970-01-01
    • 2014-07-25
    • 1970-01-01
    • 1970-01-01
    • 2012-10-15
    相关资源
    最近更新 更多