Ambari Server Host Addition in Ubuntu

Apachi Ambari provides a graphical user interface (GUI) to monitor Apachi Hadoop clusters. The installation process of ambari server can be found here. To add a new host in Ambari server, the host must have Fully Qualified Domain Name (FQDN) and password less SSH connection needs to be established between host and server. There are several steps that needs to be followed in order to add host successfully.

Host Settings:

  1. Add new user:
    sudo adduser --force-badname spark01.local
    –force-badname: Since dot(.) is added in username to fulfill the requirement of FQDN.

    Grant user sudo privileges:
    sudo visudo

    Search for the line:
    root       ALL=(ALL:ALL) ALL

    Below this line add:
    spark01.local      ALL=(ALL:ALL) ALL

  2. Change hostname:
    Hostname can be changed manually in /etc/hosts and /etc/hostname file or bash script can be downloaded from github. Execute this file to change hostname i.e., spark01.local.
  3. Login to the new user account spark01.local
    Previous user (considered here as spark01), can be removed if it’s not needed.
    userdel spark01

    Its home directory can also be deleted.
    rm –rf /home/spark01

  4. Add ip address of server and host to /etc/hosts file   sparkserver.local   sparkserver   spark01.local   spark01
  5. Update host system to avoid errors while adding it from server
    apt-get update
  6. Generate new ssh key:
    • Sign in as a root user:
      sudo su
    • Remove .ssh directory if it exists:
      rm –rf /root/.ssh
    • Generate a new key:
      ssh-keygen –t dsa
    • Press enter when prompted
      Enter file in which to save the key (/root/.ssh/id_dsa):
      Enter passphrase (empty for no passphrase):
      Enter same passphrase again:
    • Copy public key in authorized keys:
      cat /root/ >> /root/.ssh/authorized_keys
    • Copy public ssh key on server:
      ssh-copy-id sparkserver.local@
    • Copy private ssh key on server to be used while adding host:
      scp id_dsa sparkserver.local@

Server Settings:

The public ssh key in step (6) is copied in /home/sparkserver.local/.ssh directory.

  1. Copy the key of spark01.local from /home/sparkserver.local/.ssh/authorized_keys to /root/.ssh/authorized_keys.
    This provides password less connection for root from spark01.local to sparkserver.
  2. Copy ssh key of sparkserver.local to spark01.local
    ssh-copy-id spark01.local@
  3. If connection is refused by host on port 22, check if openssh-server is installed on host
    ps -ef | grep ssh
    If openssh-server is not installed then this can be installed by
    apt-get install openssh-server
  4. In host machine, copy the ssh key of sparkserver.local from /home/spark01.local/.ssh/authorized_keys to /root/.ssh/authorized_keys.

Now, the password less connection is established between host and server. Further, spark01.local can be added as a host in sparkserver.local. The procedure for creating cluster can be found here.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s