Support Questions
Find answers, ask questions, and share your expertise

Ambar-Server is not starting

Hi,

When start the ambari-server getting error ,please look at logs for more info

Caused by: java.net.ConnectException: Connection refused (Connection refused)

at java.net.PlainSocketImpl.socketConnect(Native Method)

at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)

at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)

at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)

at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)

at java.net.Socket.connect(Socket.java:589)

at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:155)

at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:65)

... 15 more


8 REPLIES 8

Super Mentor

@ram sriram

We see that ambari is not able to communicate with the MySQL database.

Caused by: java.net.ConnectException: Connection refused (Connection refused)
     .
     .
     at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:155)

So please check if your MySQL database is up and running? Also please check if from ambari server host you are able to establish mysql connection?

You can find the MySQL database details from ambari.properties file by grepping the following:

# grep 'jdbc' /etc/ambari-server/conf/ambari.properties

.

Check if the MySQL Host & Port are accessible from ambari server host ? It may be a Firewall (Port blocking issue) so please check if mysql port is accessible from ambari server host.

# telnet  $MySQL_HOST  3306






Super Mentor

@ram sriram

You can also use the following Utility which is shipped with Ambari to verify the MySQL connectivity from ambari server host:

# /usr/jdk64/jdk1.8.0_112/bin/java -cp /var/lib/ambari-server/resources/DBConnectionVerification.jar:/usr/share/java/mysql-connector-java.jar  org.apache.ambari.server.DBConnectionVerification  "jdbc:mysql://MySQL.example.com/ambari" "ambari" "bigdata" com.mysql.jdbc.Driver

.
Please make sure to replace the values of Jdbc URL , Username, Password and the "mysql-connector-java.jar" jar location based on your environment details.

You will need to replace the following:

"/usr/share/java/mysql-connector-java.jar" => With your mysql jdbc connector jar location
"jdbc:mysql://MySQL.example.com/ambari" => the MYSQL server URL that you can find in your ambari.properties.
"ambari" => MySQL Database username
"bigdata" => MySQL Database password

Hi @Jay Kumar SenSharma ,

Thanks much for your reply,i did all things which ever you said above,but still am getting same error.when i start the ambari server.

Super Mentor

@ram sriram

- Can you please share the output of the MySQL connectivity check command that i shared in my previous update?

# /usr/jdk64/jdk1.8.0_112/bin/java -cp /var/lib/ambari-server/resources/DBConnectionVerification.jar:/usr/share/java/mysql-connector-java.jar  org.apache.ambari.server.DBConnectionVerification  "jdbc:mysql://MySQL.example.com/ambari" "ambari" "bigdata" com.mysql.jdbc.Driver

AND

# telnet  $MySQL_HOST  3306 # nc -v  $MySQL_HOST  3306




- Also can you please share the output of the following command:

# grep 'jdbc' /etc/ambari-server/conf/ambari.properties

.

We will also need to see the ambari server startup log from starting till the point where it throws the "Caused by: java.net.ConnectException: Connection refused (Connection refused)" error, So can you please share the ambari-server.log here?


Hi @avatar imageJay Kumar SenSharma ,Thanks much for your reply and i did all things what ever you said above but still am getting same error when start ambari serever.

Hi @Jay Kumar SenSharma,

Please have a look at below attached output.


root@hdfs1:~# grep 'jdbc' /etc/ambari-server/conf/ambari.properties

custom.mysql.jdbc.name=mysql-connector-java-8.0.15.jar

previous.custom.mysql.jdbc.name=mysql-connector-java-8.0.15.jar

server.jdbc.connection-pool=c3p0

server.jdbc.connection-pool.acquisition-size=5

server.jdbc.connection-pool.idle-test-interval=7200

server.jdbc.connection-pool.max-age=0

server.jdbc.connection-pool.max-idle-time=14400

server.jdbc.connection-pool.max-idle-time-excess=0

server.jdbc.database=mysql

server.jdbc.database_name=ambu

server.jdbc.driver=com.mysql.jdbc.Driver

server.jdbc.driver.path=/usr/share/java/mysql-connector-java-8.0.15.jar

server.jdbc.hostname=hdfs1.hadoop.com

server.jdbc.port=3306

server.jdbc.postgres.schema=ambari

server.jdbc.rca.driver=com.mysql.jdbc.Driver

server.jdbc.rca.url=jdbc:mysql://hdfs1.hadoop.com:3306/ambu

server.jdbc.rca.user.name=root

server.jdbc.rca.user.passwd=/etc/ambari-server/conf/password.dat

server.jdbc.url=jdbc:mysql://hdfs1.hadoop.com:3306/ambu

server.jdbc.user.name=root

server.jdbc.user.passwd=/etc/ambari-server/conf/password.dat


root@hdfs1:~# telnet 172.24.133.86 3306

Trying 172.24.133.86...

telnet: Unable to connect to remote host: Connection refused

root@hdfs1:~#


root@hdfs1:~# nc -v 172.24.133.86 3306

nc: connect to 172.24.133.86 port 3306 (tcp) failed: Connection refused

root@hdfs1:~#


root@hdfs1:~# /usr/jdk64/jdk1.8.0_112/bin/java -cp /var/lib/ambari-server/resources/DBConnectionVerification.jar:/usr/share/java/mysql-connector-java-8.0.15.jar org.apache.ambari.server.DBConnectionVerification "jdbc:mysql://hdfs1.hadoop.com.com/ambari" "ambu" "password" com.mysql.jdbc.Driver

Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.


Super Mentor

@ram sriram


As we see that even the "telnet" or netcat command is not able to connect to the mentioned IP Address and Port 3306 which means either your MySQL process is not running or It may not listening to the mentioned IP Addres/PORT or there may be a firewall issue.

root@hdfs1:~# telnet 172.24.133.86 3306
Trying 172.24.133.86...
telnet: Unable to connect to remote host: Connection refused
root@hdfs1:~#

root@hdfs1:~# nc -v 172.24.133.86 3306
nc: connect to 172.24.133.86 port 3306 (tcp) failed: Connection refused
root@hdfs1:~#


So please check the following:

1. Login to your MySQL server host and then check if the MySQL process is running and listening to the port?

# netstat -tnlpa | grep 3306
# ps -ef | grep mysqld
# service mysqld status



2. Check the MySql logs to findout if it is healthy of if it shows any error?

3. In ambari.properties file we see that the mysql hostname is "hdfs1.hadoop.com" so please check if the mentioned hostname and the IP adderss "172.24.133.86" are mapping properly?
.

Also as you are using non default database as MySQL for Ambari Server hence please check if you have performed the mentioned action properly while setting up the ambari server ?


https://docs.hortonworks.com/HDPDocuments/Ambari-2.6.2.2/bk_ambari-administration/content/using_amba...


Hi @Jay Kumar SenSharma,

Please look into the below ambari-server.log

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

at sun.reflect.GeneratedConstructorAccessor40.newInstance(Unknown Source)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)

at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)

at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151)

at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167)

at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:91)

at com.mysql.cj.NativeSession.connect(NativeSession.java:152)

at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:955)

at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:825)

... 12 more

Caused by: java.net.ConnectException: Connection refused (Connection refused)

at java.net.PlainSocketImpl.socketConnect(Native Method)

at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)

at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)

at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)

at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)

at java.net.Socket.connect(Socket.java:589)

at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:155)

at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:65)

... 15 more