我有点怀疑你在刷屏

logstash jdbc 报 Unable to connect to database. Tried 1 times

Logstash | 作者 kuang135 | 发布于2019年12月25日 | 阅读数:3945

问题:logstash jdbc 运行一段时候后就停掉,日志为
[2019-12-24T10:34:14,573][ERROR][logstash.inputs.jdbc ] Unable to connect to database. Tried 1 times {:error_message=>"Java::JavaSql::SQLException: Io exception: The Network Adapter could not establish the connection"}
[2019-12-24T10:34:14,682][FATAL][logstash.runner ] An unexpected error occurred! {:error=>#<SystemCallError: Unknown error (SystemCallError) - <STDERR>>, :backtrace=>["org/jruby/RubyIO.java:1457:in `write'", "org/jruby/RubyIO.java:1428:in `write'", "org/jruby/RubyIO.java:2584:in `write'", "org/jruby/RubyIO.java:2451:in `puts'", "/usr/local/logstash-6.3.2/vendor/bundle/jruby/2.3.0/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler.rb:503:in `on_error'", "/usr/local/logstash-6.3.2/vendor/bundle/jruby/2.3.0/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler/jobs.rb:242:in `do_call'", "/usr/local/logstash-6.3.2/vendor/bundle/jruby/2.3.0/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler/jobs.rb:258:in `do_trigger'", "/usr/local/logstash-6.3.2/vendor/bundle/jruby/2.3.0/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler/jobs.rb:300:in `block in start_work_thread'", "/usr/local/logstash-6.3.2/vendor/bundle/jruby/2.3.0/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler/jobs.rb:299:in `block in start_work_thread'", "org/jruby/RubyKernel.java:1292:in `loop'", "/usr/local/logstash-6.3.2/vendor/bundle/jruby/2.3.0/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler/jobs.rb:289:in `block in start_work_thread'"]}
[2019-12-24T10:34:14,802][ERROR][org.logstash.Logstash ] java.lang.IllegalStateException: Logstash stopped processing because of an error: (SystemExit) exit
背景:es,kibana,logstash安装在同一台机子上,top查看一瞬间的内存消耗为logstash-14.1 es-31.9 kibana-2.3。
下面为jdbc.conf的配置,
input {
jdbc {
type => "jq_jjd"
jdbc_connection_string => "jdbc:oracle:thin:@10.120.233.88:1521/jxdb"
jdbc_user => "jjdnh"
jdbc_password => "zjipst_nh"
jdbc_driver_library => "/usr/local/logstash-6.3.2/jdbc/ojdbc-11.jar"
jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
connection_retry_attempts => 60
connection_retry_attempts_wait_time => 60
statement_filepath => "/usr/local/logstash-6.3.2/jdbc/sql_110jq_jjd_new.sql"
schedule => "* * * * *"
clean_run => false
record_last_run => true
last_run_metadata_path => "/usr/local/logstash-6.3.2/jdbc/last_run_metadata_110jq_jjd"
use_column_value => true
tracking_column => "sjgxsj"
tracking_column_type => "timestamp"
sql_log_level => "warn"
}
jdbc {
type => "jq_fkd"
jdbc_connection_string => "jdbc:oracle:thin:@10.120.233.88:1521/jxdb"
jdbc_user => "jjdnh"
jdbc_password => "zjipst_nh"
jdbc_driver_library => "/usr/local/logstash-6.3.2/jdbc/ojdbc-11.jar"
jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
connection_retry_attempts => 60
connection_retry_attempts_wait_time => 60
statement_filepath => "/usr/local/logstash-6.3.2/jdbc/sql_110jq_fkd_new.sql"
schedule => "* * * * *"
clean_run => false
record_last_run => true
last_run_metadata_path => "/usr/local/logstash-6.3.2/jdbc/last_run_metadata_110jq_fkd"
use_column_value => true
tracking_column => "sjgxsj"
tracking_column_type => "timestamp"
sql_log_level => "warn"
}
jdbc {
type => "rfid"
jdbc_connection_string => "jdbc:oracle:thin:@10.120.145.100:1521:ORCL"
jdbc_user => "EVI3"
jdbc_password => "EVI3"
jdbc_driver_library => "/usr/local/logstash-6.3.2/jdbc/ojdbc-11.jar"
jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
statement_filepath => "/usr/local/logstash-6.3.2/jdbc/sql_rfid.sql"
schedule => "*/30 * * * *"
clean_run => false
record_last_run => true
last_run_metadata_path => "/usr/local/logstash-6.3.2/jdbc/last_run_metadata_rfid"
use_column_value => true
tracking_column => "modifytime"
tracking_column_type => "timestamp"
sql_log_level => "warn"
}
jdbc {
type => "xxsb"
jdbc_connection_string => "jdbc:sqlserver://41.226.178.166:1433;databaseName=nhga201611qb"
jdbc_user => "sa"
jdbc_password => "he110wOrLd"
jdbc_driver_library => "/usr/local/logstash-6.3.2/jdbc/sqljdbc4-4.0.jar"
jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
connection_retry_attempts => 60
connection_retry_attempts_wait_time => 60
statement_filepath => "/usr/local/logstash-6.3.2/jdbc/sql_xxsb.sql"
schedule => "*/10 * * * *"
clean_run => false
record_last_run => true
last_run_metadata_path => "/usr/local/logstash-6.3.2/jdbc/last_run_metadata_xxsb"
use_column_value => true
tracking_column => "modifydate"
tracking_column_type => "timestamp"
sql_log_level => "warn"
}
}
filter {
if [type]=="jq_jjd" {
alter {
add_field => {
"[my_join_field][name]" => "jq_jjd"
}
}
}
if [type]=="jq_fkd" {
alter {
add_field => {
"[my_join_field][name]" => "jq_fkd"
"[my_join_field][parent]" => "%{jjdbh}"
}
}
}
}
output {
if [type]=="jq_jjd" {
elasticsearch {
hosts => ["10.120.143.74:9200"]
index => "110jq_jjd_fkd"
document_type => "_doc"
document_id => "%{jjdbh}"
}
}
if [type]=="jq_fkd" {
elasticsearch {
hosts => ["10.120.143.74:9200"]
index => "110jq_jjd_fkd"
document_type => "_doc"
document_id => "%{fkdbh}"
routing => "%{jjdbh}"
}
}
if [type]=="rfid" {
elasticsearch {
hosts => ["10.120.143.74:9200"]
index => "rfid"
document_type => "_doc"
document_id => "%{id}"
}
}
if [type]=="xxsb" {
elasticsearch {
hosts => ["10.120.143.74:9200"]
index => "xxsb"
document_type => "_doc"
document_id => "%{id}"
}
}
}
难道就是因为数据库连接不上吗,但是为什么我配置的connection_retry_attempts 没有用
已邀请:

locatelli

赞同来自:

Oracle连接有问题,不是ES的问题。这个错误信息是oracle的。
主要查一下数据库是否在运行,从ES到数据库网络是否连通,jdbc url有没有错等等。

要回复问题请先登录注册