{"id":6467,"date":"2021-07-17T14:00:38","date_gmt":"2021-07-17T08:30:38","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=6467"},"modified":"2021-07-17T14:00:42","modified_gmt":"2021-07-17T08:30:42","slug":"errorlogstash-inputs-jdbc-unable-to-connect-to-database-tried-1-times-error_messagejavacommysqljdbcexceptionsjdbc4communicationsexception-communications-link-failurennthe-last-pa","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/errorlogstash-inputs-jdbc-unable-to-connect-to-database-tried-1-times-error_messagejavacommysqljdbcexceptionsjdbc4communicationsexception-communications-link-failurennthe-last-pa\/","title":{"rendered":"[ERROR][logstash.inputs.jdbc Unable to connect to database. Tried 1 times {:error_message=&gt;&#8221;Java::ComMysqlJdbcExceptionsJdbc4::CommunicationsException: Communications link failure\\n\\nThe last packet successfully received from the server was 1 milliseconds ago.  The last packet sent successfully to the server was 1 milliseconds ago.&#8221;}"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">This can happen for a variety of reasons. Please troubleshoot the issue by following the steps below one by one. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1) Verify the address mysql is bound to, it&#8217;s probably 127.0.0.1 (only) which I believe is the default (at least on standard Ubuntu server). You&#8217;ll have to comment out the bind-address parameter in my.cnf to bind to all available addresses (you can&#8217;t choose multiple, it&#8217;s one or all).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2) If it is bound to 127.0.0.1 and you can&#8217;t connect using &#8220;localhost&#8221;, make sure it&#8217;s not resolving to the IPv6 localhost address instead of IPv4. (or just use the IP address)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3) Double and triple-check the port that mysql is listening on.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">4) Make sure you&#8217;re using the right JDBC connector for your JDK.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">5) Make sure you&#8217;re not doing something really silly like starting mysql with &#8211;skip-networking.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We have faced the issue with the JDBC connector. We have replaced the old JDBC connector with the latest one and everything worked fine.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This can happen for a variety of reasons. Please troubleshoot the issue by following the steps below one by one. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1019],"tags":[836,896,897,895],"class_list":["post-6467","post","type-post","status-publish","format-standard","hentry","category-cloud-aws","tag-database-connection-issues","tag-jdbc","tag-jdbc-connector","tag-logstash","psol-cat-cloud-aws"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-1Gj","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/6467","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=6467"}],"version-history":[{"count":0,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/6467\/revisions"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=6467"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=6467"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=6467"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}