Support Questions

Find answers, ask questions, and share your expertise

unable to start ambari-server

avatar

I have followed http://docs.hortonworks.com/HDPDocuments/Ambari-2.1.2.0/bk_Installing_HDP_AMB/content/_download_the_...

link to install ambari-server whose version is 2.1.2

and for mysql I followed https://docs.hortonworks.com/HDPDocuments/Ambari-2.1.1.0/bk_ambari_reference_guide/content/_using_am...

sudo ambari-server start

Using python /usr/bin/python2.7 Starting ambari-server Ambari Server running with administrator privileges. Organizing resource files at /var/lib/ambari-server/resources... Server PID at: /var/run/ambari-server/ambari-server.pid Server out at: /var/log/ambari-server/ambari-server.out Server log at: /var/log/ambari-server/ambari-server.log Waiting for server start......... ERROR: Exiting with exit code -1. REASON: Ambari Server java process died with exitcode 1. Check /var/log/ambari-server/ambari-server.out for more information.

and the error in /var/log/ambari-server/ambari-server.log is

ERROR [main] DBAccessorImpl:102 - Error while creating database accessor com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

and i have copied these jars in the /usr/share/java folder and also gave classpath for these jars in bashrc

7762-ambari-server-jars.png

1 ACCEPTED SOLUTION

avatar

Its working now. I had to change my ambari.properties file...

added

db.mysql.jdbc.name=/var/lib/ambari-server/resources/mysql-connector-java-5.1.28.jar

and modified these lines

server.jdbc.rca.url=jdbc:mysql://localhost:3306/ambari

server.jdbc.url=jdbc:mysql://localhost:3306/ambari

View solution in original post

9 REPLIES 9

avatar

Please help me with this issue

avatar
Super Collaborator

@Santhoshi G try exporting the classpath in /var/lib/ambari-server/ambari-env.sh and restart ambari-server

avatar

Thanks pankaj for the reply, I added

export CLASSPATH=$CLASSPATH:/usr/share/java/mysql-connector-java-5.1.28.jar

export CLASSPATH=$CLASSPATH:/usr/share/java/mysql.jar

export CLASSPATH=$CLASSPATH:/usr/share/java/mysql-connector-java.jar

in /var/lib/ambari-server/ambari-env.sh

but again the same error is appearing

avatar
Master Guru

can you connect to mysql from mysql cli or mysqladmin?

make sure its working

make sure you have rwx permissions for mysql directories

check the /var/log/mysql logs

make sure you can access mysql

telnet localhost 3306

make sure you have iptables and firewalls on your machine (and any on your network off) some firewalls in corporate or on your comcast/verizon/cable router will block some mysql ports)

See here:

http://stackoverflow.com/questions/6865538/solving-a-communications-link-failure-with-jdbc-and-mysql

Is mysql setup and running?

make sure your bind-address is set correctly to 127... or 0..

Linux: /etc/mysql/my.cnf or /etc/my.cnf

avatar

Hello Spann,

I'm able to connect to mysql cli, and I'm able to connect to mysql through other projects of mine.

My bind address is 127.0.0.1 and logs in /var/log/mysql/error.log is empty.

Output for telnet localhost 3306

Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'. [ 5.6.31-0ubuntu0.14.04.2�"q7[E(7�{!-_uS{54B3smysql_native_password

Connection closed by foreign host.

And the same error is appearing in logs.

ERROR [main] DBAccessorImpl:102 - Error while creating database accessor 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.

avatar

And the permissions for mysql are:

/var/lib$ ls -l | grep 'mysql'

drwx------ 6 mysql mysql 4096 Sep 20 10:26 mysql

avatar
Expert Contributor

avatar

Hello Mohan,

I tried this link. No use

avatar

Its working now. I had to change my ambari.properties file...

added

db.mysql.jdbc.name=/var/lib/ambari-server/resources/mysql-connector-java-5.1.28.jar

and modified these lines

server.jdbc.rca.url=jdbc:mysql://localhost:3306/ambari

server.jdbc.url=jdbc:mysql://localhost:3306/ambari