Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Ambari 2.7.3.0-139: SQLException: SQL state: 08S01 com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

avatar
Explorer
I get the following error condition: 2019-07-31 15:40:46,158 - Stack Feature Version Info: Cluster Stack=3.1, Command Stack=None, Command Version=None -> 3.1

Using openjdk version "1.8.0_212", Hortonworks 3.1

I have checked all solution aspects in com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure and https://community.hortonworks.com/content/supportkb/196253/commysqljdbcexceptionsjdbc4communications... . They all don't help with my problem.

Command aborted. Reason: 'Server considered task failed and automatically aborted it'
2019-07-31 17:00:22,742 - Stack Feature Version Info: Cluster    Stack=3.1, Command Stack=None, Command Version=None -> 3.1
2019-07-31 17:00:22,746 - Using hadoop conf dir: /usr/hdp/3.1.0.0-78/hadoop/conf

2019-07-31 17:00:23,140 - Setting up Ranger KMS DB and DB User
2019-07-31 17:00:23,141 - Execute['ambari-python-wrap /usr/hdp/current/ranger-kms/dba_script.py -q'] {'logoutput': True, 'environment': {'RANGER_KMS_HOME': u'/usr/hdp/current/ranger-kms', 'JAVA_HOME': u'/usr/lib/jvm/java-8-openjdk-amd64/'}, 'tries': 5, 'user': 'kms', 'try_sleep': 10}
2019-07-31 17:00:23,173  [I] Running DBA setup script. QuiteMode:True
2019-07-31 17:00:23,173  [I] Using Java:/usr/lib/jvm/java-8-openjdk-amd64/bin/java
2019-07-31 17:00:23,173  [I] DB FLAVOR:MYSQL
2019-07-31 17:00:23,173  [I] DB Host:<FQDN_of_servername>
2019-07-31 17:00:23,173  [I] ---------- Verifing DB root password ---------- 
2019-07-31 17:00:23,174  [I] DBA root user password validated
2019-07-31 17:00:23,174  [I] ---------- Verifing Ranger KMS db user password ---------- 
2019-07-31 17:00:23,174  [I] KMS user password validated
2019-07-31 17:00:23,174  [I] ---------- Creating Ranger KMS db user ---------- 
2019-07-31 17:00:23,174  [JISQL] /usr/lib/jvm/java-8-openjdk-amd64/bin/java  -cp /usr/hdp/current/ranger-kms/ews/webapp/lib/mysql-connector-java.jar:/usr/hdp/current/ranger-kms/jisql/lib/* org.apache.util.sql.Jisql -driver mysqlconj -cstring jdbc:mysql://<FQDN_of_servername>/mysql -u root -p '********' -noheader -trim -c \; -query "SELECT version();"
SQLException : SQL state: 08S01 com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. ErrorCode: 0
2019-07-31 17:00:23,402  [E] Can't establish db connection.. Exiting..
2019-07-31 17:00:23,407 - Retrying after 10 seconds. Reason: Execution of 'ambari-python-wrap /usr/hdp/current/ranger-kms/dba_script.py -q' returned 1. 2019-07-31 17:00:23,173  [I] Running DBA setup script. QuiteMode:True
2019-07-31 17:00:23,173  [I] Using Java:/usr/lib/jvm/java-8-openjdk-amd64/bin/java
2019-07-31 17:00:23,173  [I] DB FLAVOR:MYSQL
2019-07-31 17:00:23,173  [I] DB Host:<FQDN_of_servername>
2019-07-31 17:00:23,173  [I] ---------- Verifing DB root password ---------- 
2019-07-31 17:00:23,174  [I] DBA root user password validated
2019-07-31 17:00:23,174  [I] ---------- Verifing Ranger KMS db user password ---------- 
2019-07-31 17:00:23,174  [I] KMS user password validated
2019-07-31 17:00:23,174  [I] ---------- Creating Ranger KMS db user ---------- 
2019-07-31 17:00:23,174  [JISQL] /usr/lib/jvm/java-8-openjdk-amd64/bin/java  -cp /usr/hdp/current/ranger-kms/ews/webapp/lib/mysql-connector-java.jar:/usr/hdp/current/ranger-kms/jisql/lib/* org.apache.util.sql.Jisql -driver mysqlconj -cstring jdbc:mysql://<FQDN_of_servername>/mysql -u root -p '********' -noheader -trim -c \; -query "SELECT version();"
SQLException : SQL state: 08S01 com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. ErrorCode: 0
2019-07-31 17:00:23,402  [E] Can't establish db connection.. Exiting..

Later in Ambari:

Error: 500 status code received on DELETE method for API: /api/v1/clusters/myclustername
Error message: org.apache.ambari.server.controller.spi.SystemException: An internal system exception occurred: Could not delete cluster, clusterName=myclustername
2 REPLIES 2

avatar
Master Mentor

@Thomas Poetter

it seems you DB isn't running can you just check as below can you ensure you install the mysql connector you can re-run this without any issues


yum install -y mysql-connector-java

Check MySQL status

#  ps aux | grep mysql

or

# mysqladmin -u root -p status
Enter password:
Uptime: 1697  Threads: 15  Questions: 17283  Slow queries: 0  Opens: 73  Flush tables: 2  Open tables: 99  Queries per second avg: 10.184

if not then set it up manually as the root user please re-adapt

create database rangerkms;
grant all privileges on rangerkms.* to rangerkms@'localhost' identified by 'rangerkms';
grant all privileges on rangerkms.* to rangerkms@'%.[your_domain]' identified by 'rangerkms';


Then retry


avatar
Explorer

@Geoffrey Shelton Okot Thanks, but I had registered the driver as described in the documentation:


ambari-server setup --jdbc-db=mysql --jdbc-driver=/root/dev/mysql-connector-java.jar


Furthermore, it was all part of the installation process where I chose the option "Create new MySQL DB", so that should have been done by Ambari. Unfortunately, I started another try on monday morning so that I can't follow these steps. However, I then hit this error for which none of the proposed solutions helps in my case: https://community.hortonworks.com/questions/118453/ambari-not-using-available-repos.html