I am getting java version and mysql-connect-java.jar compatibility issue with logstash.
can any one tell me which version of mysql-connect-java.jar is compatible with which version of java?
Error:
JavaScript
x
com.mysql.cj.jdbc.Driver not loaded. Are you sure you've included the correct jdbc driver in :jdbc_driver_library?
my current java version is
JavaScript
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-8u212-b03-0ubuntu1.16.04.1-b03)
OpenJDK 64-Bit Server VM (build 25.212-b03, mixed mode)
I have tried with below mysql connector jar files but every one fails.
JavaScript
mysql-connector-java-8.0.16.jar
mysql-connector-java-8.0.15.jar
mysql-connector-java-6.0.5.jar
mysql-connector-java-5.1.46.jar
mysql-connector-java-5.1.4.jar
Logstash config file is mysql.conf
JavaScript
input {
jdbc {
jdbc_connection_string => "jdbc:mysql://localhost:3306/prbi"
jdbc_user => "root"
jdbc_password => ""
jdbc_driver_library => "mysql-connector-java-8.0.15.jar" #tried above every jar
jdbc_driver_class => "com.mysql.cj.jdbc.Driver" #tried com.mysql.jdbc.Driver too
schedule => "* * * * *"
use_column_value => true
tracking_column => "%{id}"
clean_run => true
statement => "SELECT * from tmp_j_summaryrepor"
}
}
output {
elasticsearch {
hosts => ['http://localhost:9200']
index => "prsummaryreport"
document_type => "prsummaryreport"
document_id => "%{id}" # It is a Primary Key of table
}
stdout { codec => json_lines }
}
Advertisement
Answer
for logstash 6.2.x and above, prefer adding the drivers under:
JavaScript
/usr/share/logstash/logstash-core/lib/jars/
and rather keep the jdbc_driver_library
empty. this has been quoted in many of the elastic.co forums too.