I'm new here and also to logstash.
I'm having trouble trying to connect.
I have several branches spread across Brazil, I get data from each one through a VPN connection, and I use a .sh scheduled in CRON to call the scripts, but when the access to one of the branches freezes I can't finish that call and go to the next.
I want you to try 3 times and after the third try it's finished.
[2022-03-16T00:04:20,694][ERROR][logstash.inputs.jdbc ][main][e96d8a80a28becfb9fc7e8f415363a3a2cd75d922e53fadbc0f6c034deb089bc]
java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
at oracle.jdbc.driver.T4CConnection.logon(oracle/jdbc/driver/T4CConnection.java:805) ~[ojdbc8.jar:18.15.0.0.0]
at oracle.jdbc.driver.PhysicalConnection.connect(oracle/jdbc/driver/PhysicalConnection.java:782) ~[ojdbc8.jar:18.15.0.0.0]
at oracle.jdbc.driver.T4CDriverExtension.getConnection(oracle/jdbc/driver/T4CDriverExtension.java:39) ~[ojdbc8.jar:18.15.0.0.0]
at oracle.jdbc.driver.OracleDriver.connect(oracle/jdbc/driver/OracleDriver.java:704) ~[ojdbc8.jar:18.15.0.0.0]
...
Caused by: oracle.net.ns.NetException: The Network Adapter could not establish the connection
...
Caused by: java.io.IOException: Connection timed out, socket connect lapse 31582 ms.
...
Caused by: java.net.ConnectException: Connection timed out
Enters an infinite loop causing the queue to stop.
I already have several extractions running, my problem is just ending the script when I can't access the destination:
If the first one doesn't finish it doesn't go to the second.
Here's an example .sh:
SQLRecoverableException is a sub-class of java.sql.SQLException, so I would expect the code to be going through this path. Are you seeing the "Unable to connect to database" messages?
[2022-03-16T00:04:20,706][ERROR][logstash.inputs.jdbc ][main][e96d8a80a28becfb9fc7e8f415363a3a2cd75d922e53fadbc0f6c034deb089bc] **Unable to connect to database**. Tried 1 times {:message=>"Java::JavaSql::SQLRecoverableException: IO Error: The Network Adapter could not establish the connection", :exception=>Sequel::DatabaseConnectionError, :cause=>java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection, :backtrace=>["oracle.jdbc.driver.T4CConnection.logon(oracle/jdbc/driver/T4CConnection.java:805)", "oracle.jdbc.driver.PhysicalConnection.connect(oracle/jdbc/driver/PhysicalConnection.java:782)", "oracle.jdbc.driver.T4CDriverExtension.getConnection(oracle/jdbc/driver/T4CDriverExtension.java:39)", "oracle.jdbc.driver.OracleDriver.connect(oracle/jdbc/driver/OracleDriver.java:704)", "jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)", "jdk.internal.reflect.NativeMethodAccessorImpl.invoke(jdk/internal/reflect/NativeMethodAccessorImpl.java:62)", "jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(jdk/internal/reflect/DelegatingMethodAccessorImpl.java:43)", "java.lang.reflect.Method.invoke(java/lang/reflect/Method.java:566)", ...
OK, so the retry logic is working as expected. You would like logstash to exit if it fails to start the pipeline. Instead I suspect it will endlessly try to restart the pipeline. There is no way to turn that off.
Instead of using a jdbc input it might be possible to fetch the data to a file using an SQL tool, then cat the file into logstash with a stdin input. That will shutdown the instance after it reaches end-of-file.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.