HDPCA Exam Objective – Install ambari agent

Note: This is post is part of the HDPCA exam objective series

The ambari agent communicates with the ambari server and provides all the necessary information required to the ambari-server. This post outlines the steps to install and configure the ambari agent. The ambari agents need to be installed in all the nodes in the HDP cluster.

1. Simlar to ambari-agent installation, first we will have to download the ambari repository file.

# wget -nv http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.1.0/ambari.repo -O /etc/yum.repos.d/ambari.repo
2018-06-27 17:14:55 URL:http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.1.0/ambari.repo [280/280] -> "/etc/yum.repos.d/ambari.repo" [1]

You can get the latest ambari repository from here : https://docs.hortonworks.com/HDPDocuments/Ambari-2.1.0.0/bk_Installing_HDP_AMB/content/_ambari_repositories.html

2. Verify the ambari repo file:

# cat /etc/yum.repos.d/ambari.repo
#VERSION_NUMBER=2.1.0-1470

[Updates-ambari-2.1.0]
name=ambari-2.1.0 - Updates
baseurl=http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.1.0
gpgcheck=1
gpgkey=http://public-repo-1.hortonworks.com/ambari/centos7/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1

3. To install the ambari agent on CentOS/RHEL 7 server use the yum package manager:

# yum install ambari-agent

Configuring ambari agent

The ambari agent use the configuration file /etc/ambari-agent/conf/ambari-agent.ini to configure all the settings in cluster nodes. For now just change the hostname to the ambari-server hostname in this configuration file.

# vim /etc/ambari-agent/conf/ambari-agent.ini
[server]
hostname=ambari-server.mylabserver.com
url_port=8440
secured_url_port=8441

Start / Stop Ambari-agent

You can check the current status of the ambari agent using the command “ambari-agent status”:

# ambari-agent status
ambari-agent currently not running

To start the ambari-agent:

# ambari-agent start
Verifying Python version compatibility...
Using python  /usr/bin/python2.7
Checking for previously running Ambari Agent...
Starting ambari-agent
Verifying ambari-agent process status...
Ambari Agent successfully started
Agent PID at: /var/run/ambari-agent/ambari-agent.pid
Agent out at: /var/log/ambari-agent/ambari-agent.out
Agent log at: /var/log/ambari-agent/ambari-agent.log

Verify the status again:

# ambari-agent status
Found ambari-agent PID: 2283
ambari-agent running.
Agent PID at: /var/run/ambari-agent/ambari-agent.pid
Agent out at: /var/log/ambari-agent/ambari-agent.out
Agent log at: /var/log/ambari-agent/ambari-agent.log

To stop the ambari-agent:

# ambari-agent stop
Verifying Python version compatibility...
Using python  /usr/bin/python2.7
Found ambari-agent PID: 2195
Stopping ambari-agent
Removing PID file at /var/run/ambari-agent/ambari-agent.pid
ambari-agent successfully stopped
Related Post