URGENT! Elastic search: Unable to perform jdbc query because of Exception when executing JDBC query

I have a sample logstash conf file, However when I. run it I can see a logstash error caused
Error is

    [371de1f7cad8c35c02e4a3047ec831da42b9b5048183b45a3916162ab248f3f7] Exception when executing JDBC query {:exception=>"Java::ComMysqlCjJdbcExceptions::CommunicationsException: Communications link failure\n\nThe last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server."}
Below is the logstash config file:
    input {
      jdbc {
        jdbc_driver_library => "/usr/share/logstash/mysql-connector-java-8.0.22.jar"
        jdbc_driver_class => "com.mysql.cj.jdbc.Driver"
        jdbc_connection_string => "jdbc:mysql://xxx-1.x-xxxefxxxdxxxo3.us-east-2.rds.amazonaws.com:3306/sercdb_dev"
        jdbc_user => "user"
        jdbc_password => "pass"
        sql_log_level => "debug"  # Set Logstash logging level as this
        clean_run => true # Set to true for indexing from scratch
        record_last_run => false
    	tracking_column => "id"
        statement => "SELECT * FROM people"
      }
    }
    
    ## Add your filters / logstash plugins configuration here
    
    output {
    	elasticsearch {
    		hosts => "elasticsearch:9200"
    		user => "elastic"
    		password => "elastic"
    		ecs_compatibility => disabled
    		index => "users"
        	action => "index"
        	document_id => "%{id}"
    	}
    }

Are you sure that the jdbc_connection_string is correct? A communication link failure exception usually happens when jdbc is not able to connect at all.
This could be because of a TLS error, or your bind-address for your mysql server is not 0.0.0.0, your port is incorrect or not listening, your sql server is not running, a firewall is preventing external connections, and much more. You need to check all the basics first.

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