Support Questions
Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Innovation Accelerator group hub.

first time installation of ambari-server is working. Need help on ubuntu 14.04

I am trying to install ambari server on ubuntu 14.04 Below are few details for the same:

root@chaithu:~# hostname
chaithu
root@chaithu:~# hostname -f
chaithu
root@chaithu:~# cat /etc/hosts
127.0.0.1   localhost
127.0.1.1   chaithu
# The following lines are desirable for IPv6 capable hosts::1  ip6-localhost ip6-loopbackfe00::0 ip6-localnetff00::0 ip6-mcastprefixff02::1 ip6-allnodesff02::2 ip6-allrouters

root@chaithu:~# ssh root@chaithu
root@chaithu's password:
(here it is asking for password, I have installed ssh also dont know why asking for password and  what password i need to enter here)

Installed mysql and configured ambariuser successfully:

mysql> CREATE USER 'ambariuser'@'%' IDENTIFIED BY 'ambaripassword';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'ambariuser'@'%';
mysql> CREATE USER 'ambariuser'@'localhost' IDENTIFIED BY 'ambaripassword';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'ambariuser'@'localhost';
mysql> CREATE USER 'ambariuser'@'chaithu' IDENTIFIED BY 'ambaripassword';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'ambariuser'@'chaithu';
mysql> FLUSH PRIVILEGES;

$ mysql -u ambariuser -p

mysql> create database ambaridatabase;

mysql> use ambaridatabase;

mysql> SOURCE Ambari-DDL-MySQL-CREATE.sql;

Ambari Server setup as shown below:

root@chaithu:/home/chaithu# ambari-server setup
Using python  /usr/bin/pythonSetup ambari-serverChecking SELinux...WARNING: Could not run /usr/sbin/sestatus: OKCustomize user account for ambari-server daemon [y/n] (n)? n
Enter advanced database configuration [y/n] (n)? y
Enter choice (1): 3
Hostname (localhost): chaithu
Port (3306): 3306
Database name (ambari): ambaridatabase
Username (ambari): ambariuser
Enter Database Password (bigdata): 
Re-enter password: 
Configuring ambari database...Configuring remote database connection properties...
WARNING: Before starting Ambari Server, you must run the following DDL against the database to create the schema: /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql

Proceed with configuring remote database connection properties [y/n] (y)? yExtracting system views......ambari-admin-2.6.0.0.267.jar........Adjusting ambari-server permissions and ownership...Ambari Server 'setup' completed successfully.

Then I have started ambari- server but facing below error:

root@chaithu:/home/chaithu# ambari-server start
Using python  /usr/bin/pythonStarting
ambari-serverAmbari Server running with administrator privileges.
Organizing resource files at /var/lib/ambari-server/resources...
Ambari database consistency check started...
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 has stopped. Please check the logs for more information.

First Error in log: /var/log/ambari-server/ambari-server.log is as shown below:

29 Nov 2017 09:24:07,830 ERROR [main] DBAccessorImpl:119 - 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.
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)

Kindly help me to configure the correct way to install ambari-server successfully. Thanks In Advance.

1 ACCEPTED SOLUTION

@Chaitanya D,

Can you try adding these 3 lines in /etc/ambari-server/conf/ambari.properties and try restarting the server

db.mysql.jdbc.name=/var/lib/ambari-server/resources/mysql-connector-java.jar
server.jdbc.rca.url=jdbc:mysql://localhost:3306/ambaridatabase
server.jdbc.url=jdbc:mysql://localhost:3306/ambaridatabase

1) Check if server.jdbc.user.name is ambariuser in /etc/ambari-server/conf/ambari.properties.

2) Make sure that this path exists /var/lib/ambari-server/resources/mysql-connector-java.jar. Or change the path if the connector jar name is different.

3) If localhost doesn't work , try changing to 127.0.0.1 in server.jdbc.rca.url and server.jdbc.url

Thanks,

Aditya

View solution in original post

9 REPLIES 9

Super Mentor

@Chaitanya D

We see that ambari-server startup is not successful as we see that it is showing the exit code as -1
Further we see the DataBase related error:

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


Above indicates that the ambari server communication with the Database "mysql" is broken Or may be the mysql database is not running. Check if mysql port 3306 is opened?

# netstat -tnlpa | grep 3306

.


Also please check if you are able to connect to mysql "ambaridatabase" DB and then list the tables?

# mysql -u ambariuser -p
Enter password: ambaripassword
mysql> use ambaridatabase;
mysql> show tables;

(AND)

# mysql  -u  ambariuser  ambaridatabase  -p
Enter password: ambaripassword
mysql> show tables;

.
Regarding the Passwordless that is not working at your end pelase refer to the following doc to know how to create passwordless ssh using "ssh-keygen": https://docs.hortonworks.com/HDPDocuments/Ambari-2.6.0.0/bk_ambari-installation-ppc/content/set_up_p...

root@chaithu:~# ssh root@chaithu
root@chaithu's password:
(here it
 is asking for password, I have installed ssh also dont know why asking 
for password and  what password i need to enter here)

.

Thanks Jay Kumar, Followed the steps for ssh but facing below error:

root@chaithu:/home/chaithu# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
/root/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
36:65:71:ae:25:9c:88:e2:a1:0a:73:09:55:3b:fa:79 root@chaithu
The key's randomart image is:
+--[ RSA 2048]----+
| ... . . |
| . . . o = |
|. = . . * o |
| . = + o + |
|o = . S . |
|.+ . . . . |
|. o E |
| . |
| |
+-----------------+
root@chaithu:/home/chaithu# .ssh/id_rsa.pub
bash: .ssh/id_rsa.pub: Permission denied
root@chaithu:/home/chaithu# sudo  .ssh/id_rsa.pub
sudo: .ssh/id_rsa.pub: command not found Also tried with the command and able to see mysql: root@chaithu:/home/chaithu# netstat -tnlpa | grep 3306 tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 1197/mysqld

and successfully able to list all tables using given commands.

Help me to create ssh, which is showing above error.

@Chaitanya D,

I guess you are trying to login to the same machine since you have 127.0.0.1 mapped to chaitu and you are trying to run 'ssh root@chaitu'

To enable password less ssh, follow below steps

sudo su  --- > to make sure you are as root
[root@chaitu ~]# cat ~/.ssh/id_rsa.pub
[root@chaitu ~]# cat ~/.ssh/id_rsa.pub  >> ~/.ssh/authorized_keys
[root@chaitu ~]# ssh root@chaitu ---> now it should not ask for password

For mysql error, change the bind address in /etc/my.cnf and restart mysql

# vi /etc/my.cnf
[mysqld]
bind-address=0.0.0.0

To restart mysql run below command

systemctl restart mysqld

Now try to start ambari server

ambari-server start

Thanks,

Aditya

yes after doing as Aditya said above again facing the same ambari-server issue:

root@chaithu:~# ssh root@chaithuWelcome to Ubuntu 14.04.5 LTS (GNU/Linux 4.4.0-31-generic x86_64) * Documentation:  https://help.ubuntu.com/New release '16.04.3 LTS' available.Run 'do-release-upgrade' to upgrade to it.Last login: Wed Nov 29 22:43:44 2017 from localhost
root@chaithu:~# netstat -tnlpa | grep 3306tcp  0  0 127.0.0.1:3306  0.0.0.0:*  LISTEN  1151/mysqld  
root@chaithu:~# ambari-server status
Using python  /usr/bin/pythonAmbari-server statusAmbari Server not running. 
Stale PID File at: /var/run/ambari-server/ambari-server.pid

Kindly help.

@Chaitanya D,

Can you try running this and then start ambari server.

chmod 644 /usr/share/java/mysql-connector-java.jar
ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar
ambari-server start

Also , did you add the bind address and restart mysql server? This output still shows 127.0.0.1

tcp  0  0 127.0.0.1:3306  0.0.0.0:*  LISTEN  1151/mysqld  

Thanks,

Aditya

yes I changed /etc/mysql/my.cnf file as you said and as i could not able to use systemctl restart mysqld, I restarted mysql using "mysqld restart"

and then performed below but error again 😞

root@chaithu:/etc/init.d# chmod 644 /usr/share/java/mysql-connector-java.jar
root@chaithu:/etc/init.d# ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar
Using python  /usr/bin/python
Setup ambari-server
Copying /usr/share/java/mysql-connector-java.jar to /var/lib/ambari-server/resources
If you are updating existing jdbc driver jar for mysql with mysql-connector-java.jar. Please remove the old driver jar, from all hosts. Restarting services that need the driver, will automatically copy the new jar to the hosts.
JDBC driver was successfully initialized.
Ambari Server 'setup' completed successfully.
root@chaithu:/etc/init.d# ambari-server start
Using python  /usr/bin/python
Starting ambari-server
Ambari Server running with administrator privileges.
Organizing resource files at /var/lib/ambari-server/resources...
Ambari database consistency check started...
Server PID at: /var/run/ambari-server/ambari-server.
pidServer 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 has stopped. Please check the logs for more information.

I dont know why I am facing this error again and again.

This is the error in /var/log/ambari-server/ambari-server.log:

29 Nov 2017 09:24:07,830 ERROR [main] DBAccessorImpl:119 - Error while creating database accessor <br>com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure<br><br>The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.<br>   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)<br>   at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)<br>   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)<br>   at java.lang.reflect.Constructor.newInstance(Constructor.java:423)<br>   at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)<br>   at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1129)<br>   at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:358)

If any one have complete end to end setup document, please share me the same so that i can follow the same.

@Chaitanya D,

Can you try adding these 3 lines in /etc/ambari-server/conf/ambari.properties and try restarting the server

db.mysql.jdbc.name=/var/lib/ambari-server/resources/mysql-connector-java.jar
server.jdbc.rca.url=jdbc:mysql://localhost:3306/ambaridatabase
server.jdbc.url=jdbc:mysql://localhost:3306/ambaridatabase

1) Check if server.jdbc.user.name is ambariuser in /etc/ambari-server/conf/ambari.properties.

2) Make sure that this path exists /var/lib/ambari-server/resources/mysql-connector-java.jar. Or change the path if the connector jar name is different.

3) If localhost doesn't work , try changing to 127.0.0.1 in server.jdbc.rca.url and server.jdbc.url

Thanks,

Aditya

Thanks Aditya... After changing to localhost as you suggested above it worked fine.

Then I logged into ambari web cluster installation and trying to create user. Have few questions here:

1. At install Option as I am using my local laptop as a cluster can i give multiple hosts for namenode, snamenode, datanode1, datanode2 if yes hot do i need to give host names here?

2. In Host Registration Information: what SSH I need to give, how can i get this?

3. what i need to give near SSH user account and SSH port number?

4. After successful installation of hosts what will be the next steps i need to proceed?

Thanks in Advance.

@Chaitanya D,

Glad that it worked. Can you please open a new question instead of piggybacking. This will divert the main thread. Please tag me in the new question and I am happy to help 🙂