HDPCA Exam Objective – Install ambari-server

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

What is ambari-server and ambari-agent

Ambari is an Apache project (http://ambari.apache.org), which in theory, provides an open source alternative to Cloudera Manager. It is the administration console for the Hortonworks distribution. At the time of writing Hortonworks employees are also the vast majority of the project contributors.

To manage an HDP cluster you need to set up an ambari-server(ideally on a separate machine) and install the ambari-agent on each of the nodes of the HDP cluster. The ambari-server then can be used to configure the entire cluster as it communicates with the ambari-agent while doing so.

Installing ambari-server

Let’s see how we can install ambari-server on a CentOS 7 server.

1. Download the ambari repository file into the directory /etc/yum/repos.d.

# wget -nv http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.2.0/ambari.repo -O /etc/yum.repos.d/ambari.repo
2018-06-28 04:31:16 URL:http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.2.0/ambari.repo [306/306] -> "/etc/yum.repos.d/ambari.repo" [1]

You can get the latest ambari repository from here : https://docs.hortonworks.com/HDPDocuments/Ambari-2.6.2.0/bk_ambari-installation/content/ambari_repositories.html

2. Verify the ambari repo file:

# cat /etc/yum.repos.d/ambari.repo
#VERSION_NUMBER=2.6.2.0-155
[ambari-2.6.2.0]
name=ambari Version - ambari-2.6.2.0
baseurl=http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.2.0
gpgcheck=1
gpgkey=http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.2.0/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1

3. Install the ambari server:

# yum install ambari-server

This will install ambari-server and all the dependencies like PostgreSQL which is the database ambari-server use by default. You can use a custom database of your own like Oracle or MySQL as well. But for the purpose of the exam and in general people use the default PostgreSQL database.

Configuring Ambari server

Once you have installed the ambari-server, you can check the status using “ambari-server status” command.

# ambari-server status
Using python  /usr/bin/python
Ambari-server status
Ambari Server not running. Stale PID File at: /var/run/ambari-server/ambari-server.pid

Disabling SELinux

It is required to disable SELinux prior to install ambari-server, as it would give you an error saying that SELinux is in Enabled mode. In my case, it is “permissive” which is fine to proceed with.

# ambari-server setup
Using python  /usr/bin/python
Setup ambari-server
Checking SELinux...
SELinux status is 'enabled'
SELinux mode is 'enforcing'
Temporarily disabling SELinux
WARNING: SELinux is set to 'permissive' mode and temporarily disabled.
OK to continue [y/n] (y)? y

User to run Ambari-server

By default root user runs the ambari-server, but if you want to change and assign a specific user, you can do it here. For our setup we will keep it as root user.

Customize user account for ambari-server daemon [y/n] (n)? n
Adjusting ambari-server permissions and ownership...

Disabling firewalld/iptables

Make sure you have the firewalld and iptables disabled as well. In my server it is already disabled.

Checking firewall status...
Redirecting to /bin/systemctl status iptables.service
Unit iptables.service could not be found.

Installing JDK

Ambari-server configuration will provide the available JDK’s to install. We will go with the first option “Oracle JDK 1.8”. Do not “download and install GPL Licensed LZO packages” and select “n” for it.

Checking JDK...
[1] Oracle JDK 1.8 + Java Cryptography Extension (JCE) Policy Files 8
[2] Oracle JDK 1.7 + Java Cryptography Extension (JCE) Policy Files 7
[3] Custom JDK
==============================================================================
Enter choice (1):
To download the Oracle JDK and the Java Cryptography Extension (JCE) Policy Files you must accept the license terms found at http://www.oracle.com/technetwork/java/javase/terms/license/index.html and not accepting will cancel the Ambari Server setup and you must install the JDK and JCE files manually.
Do you accept the Oracle Binary Code License Agreement [y/n] (y)? y
Downloading JDK from http://public-repo-1.hortonworks.com/ARTIFACTS/jdk-8u112-linux-x64.tar.gz to /var/lib/ambari-server/resources/jdk-8u112-linux-x64.tar.gz
jdk-8u112-linux-x64.tar.gz... 100% (174.7 MB of 174.7 MB)
Successfully downloaded JDK distribution to /var/lib/ambari-server/resources/jdk-8u112-linux-x64.tar.gz
Installing JDK to /usr/jdk64/
Successfully installed JDK to /usr/jdk64/
Downloading JCE Policy archive from http://public-repo-1.hortonworks.com/ARTIFACTS/jce_policy-8.zip to /var/lib/ambari-server/resources/jce_policy-8.zip

Successfully downloaded JCE Policy archive to /var/lib/ambari-server/resources/jce_policy-8.zip
Installing JCE policy...
Checking GPL software agreement...
GPL License for LZO: https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html
Enable Ambari Server to download and install GPL Licensed LZO packages [y/n] (n)?

Database configuration

The default database used by ambari-server is postgresql. But you can use Oracle or mysql databases as well. You can also configure the postgresql advance settings like schema name and table names by using the advanced mode. In our case we will use the default postgresql setting and proceed.

Completing setup...
Configuring database...
Enter advanced database configuration [y/n] (n)?
Configuring database...
Default properties detected. Using built-in database.
Configuring ambari database...
Checking PostgreSQL...
Running initdb: This may take up to a minute.
Initializing database ... OK
About to start PostgreSQL
Configuring local database...
Configuring PostgreSQL...
Restarting PostgreSQL
Creating schema and user...
done.
Creating tables...
done.

Finish up the configuration

That’s all about it. You have successfully configure the ambari-server. We have used all the default options available while configuring, but you can always differ and have a advance configuration in production environments. For exam point of view default configuration is all that you need. The ambari-server will not start automatically after the installation but the postgress and other components do start automatically as shown below.

Extracting system views...
ambari-admin-2.6.2.0.155.jar
...........
Adjusting ambari-server permissions and ownership...
Ambari Server 'setup' completed successfully.

How to start and stop ambari-server

You can check the status of ambari-server post installation, and you would find that it does not start automatically.

# ambari-server status
Using python  /usr/bin/python2.7
Ambari-server status
Ambari Server not running. Stale PID File at: /var/run/ambari-server/ambari-server.pid

To start the abari server:

# 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...
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....................
Ambari Server 'start' completed successfully.

You can verify the status of the ambari-server with:

# ambari-server status
Using python  /usr/bin/python2.7
Ambari-server status
Ambari Server running
Found Ambari Server PID: 2875 at: /var/run/ambari-server/ambari-server.pid

Similarly, to stop the ambari-server:

# ambari-server stop
Using python  /usr/bin/python2.7
Stopping ambari-server
Ambari Server stopped

Accessing Ambari admin UI

The ambari server admin UI can be accessed at the “http://[hostname]:8080” URL.

http://[hostname]:8080

The default usernamd and password to login is “admin:admin”

Currently, we do not have any cluster setup, so the first screen would look something like below.

We will see in the next post how to install the cluster by installing ambari agent.

Note: One ambari server can be used to manage multiple hadoop clusters.
Related Post