Hi all,
Could you please check the code.
Environment :
OS : Windows 10
Web Server : Apache
Mysql : 5.05
JDBC : 5.1.24
Elasticsearch : 6.7(zip)
Kibana : 6.7(zip)
Logstash : 6.7(zip)
elas.conf :
input {
jdbc {
jdbc_driver_library => "/Users/nopparat.mue/Desktop/Elasticsearch/logstash-6.7.0/lib/mysql-connector-java-5.1.24-bin.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_connection_string => "jdbc:mysql://localhost:81/elas"
jdbc_user => "root"
jdbc_password => "ssc555"
statement => "SELECT * FROM elas.log"
}
}
output {
stdout { codec => json_lines }
elasticsearch {
hosts => ["localhost:9200"]
index => "love"
}
}
Error Message :
[2019-04-05T15:12:44,141][ERROR][logstash.inputs.jdbc ] Unable to connect to
database. Tried 1 times {:error_message=>"Java::ComMysqlJdbcExceptionsJdbc4::Co
mmunicationsException: Communications link failure\n\nThe last packet sent succe
ssfully to the server was 0 milliseconds ago. The driver has not received any pa
ckets from the server."}
[2019-04-05T15:12:44,181][ERROR][logstash.pipeline ] A plugin had an unre
coverable error. Will restart this plugin.
Pipeline_id:main
Plugin: <LogStash::Inputs::Jdbc jdbc_user=>"root", jdbc_password=>,
statement=>"SELECT * FROM elas.log", jdbc_driver_library=>"/Users/nopparat.mue/D
esktop/Elasticsearch/logstash-6.7.0/lib/mysql-connector-java-5.1.24-bin.jar", jd
bc_connection_string=>"jdbc:mysql://localhost:81/elas", id=>"0345ef29d67de0d5556
800503982c55930c87b8eb2621f778279de763d11a4ba", jdbc_driver_class=>"com.mysql.jd
bc.Driver", enable_metric=>true, codec=><LogStash::Codecs::Plain id=>"plain_3402
d592-ad72-4cca-8dda-87c678d1de3e", 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", conn
ection_retry_attempts=>1, connection_retry_attempts_wait_time=>0.5, parameters=>
{"sql_last_value"=>1970-01-01 00:00:00 UTC}, last_run_metadata_path=>"C:\Users
\nopparat.mue/.logstash_jdbc_last_run", use_column_value=>false, tracking_column
_type=>"numeric", clean_run=>false, record_last_run=>true, lowercase_column_name
s=>true>
Error: Java::ComMysqlJdbcExceptionsJdbc4::CommunicationsException: Communicati
ons link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driv
er has not received any packets from the server.
Exception: Sequel::DatabaseConnectionError
Stack: java.lang.reflect.Constructor.newInstance(java/lang/reflect/Constructor
)
com.mysql.jdbc.Util.handleNewInstance(com/mysql/jdbc/Util.java:411)
com.mysql.jdbc.SQLError.createCommunicationsException(com/mysql/jdbc/SQLError.ja
va:1121)