Logstash connection to Cassandra


#1

I am trying to access a Cassandra database to connect to Elasticsearch/Kibana. I have the latest versions 6.2.1 of all and installed the logstash-input-jdbc

I am getting the following error:
[2018-02-20T16:19:47,915][ERROR][logstash.inputs.jdbc ] Unable to connect to database. Tried 1 times {:error_message=>"Java::JavaSql::SQLException: No suitable driver found for jdbc:cassandra://localhost:9042/weather"}

My configuration file is:

input {
jdbc {
jdbc_connection_string => "jdbc:cassandra://localhost:9042/weather" # Your port (weather database)
jdbc_user => "" # The user value
jdbc_password => "" # The password
jdbc_driver_library => "C:/Program Files/Elastic/Logstash/logstash-6.2.1/cassandrajdbc1.1.jar" # Jar path
jdbc_driver_class => "com.dbschema.CassandraJdbcDriver" # Driver
statement => "SELECT * FROM weather" # Your query
}
}
output {
stdout { codec => json_lines }
}

I downloaded the driver from www.dbschema.com, and directly reference the jar. dbschema can access the Cassandra database.

What am I missing? Is there a better way to access Cassandra for use in Elasticsearch? That is my prime data store.


#2

I did find a solution that gets me farther. The dbschema has a number of jars that it needs to access the Cassandra database. If I include all these files, then I can access the database. One simple solution was to add all the jars (I put them into a directory 'cassandra' where the other jars were) into the CLASSPATH in the logstash.bat file:

for %%i in ("%LS_HOME%\logstash-core\lib\jars\cassandra*.jar") do (
call :concat "%%i"
)

I can now access Cassandra.


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.