Tech Blog

Ajith Vijayan Tech Blog

Tag: hadoop Page 1 of 2

Best Practices in Cluster provisioning and Management- An Overview

For creating a cluster, we want some idea about how the cluster should be created and cluster management.Here i am noting down some points for cluster creation and management process.

Platform Requirements

  • Cloudera distribution is a good option to create a Hadoop cluster since it got a well structured repository and a well defined documentation set(Advanced user may go for the builds from Apache community).
  • Cloudera Manager is designed to make administration of Hadoop simple and straight forward at any scale. With help of Cloudera manager, you can easily deploy and centrally operate the complete Hadoop stack. The application automates the installation process, reducing deployment time from week to minutes.
  • Centos is the best option as OS since it’s developed on RHEL architecture and supports all RHEL add-ones.
  • Yum install <packages> is a command that is used frequently for installing packages from remote repository. Yum install will pick the repository url from /etc/yum.repos.d, download the packages and install it in the machine. Normally yum will work in machine having internet access. But if we want to install packages in isolated environment, normal yum install will not work, because the remote repository may not be accessible in isolated environment. In that situation, we are creating a local yum repository.
  • It’s better to turn off Graphical user experience in all the host machines, for efficient utilization of memory.
  • For each installation add required environmental variables in /etc/bashrc file or /etc/profile for public access.
  • For updating environment variables from /etc/bashrc file or /etc/profile files use ‘source’ command.

Required Services

  • Ensure sshd service is running in each node to make Secure Shell access active.
  • Ensure IPtables service is stopped.
  • Oracle jdk 1.6+ should be used (instead of open JDK) for JVM Process Status(JPS) which is used for displaying currently running Hadoop daemons.

Generic Points

  • For tarball or source build installations ‘/opt’ location is preferred.
  • Rebooting the Linux machine to change configurations is a bad practice and may negatively affect the overall cluster balance.
  • For network connection issues restart network service other than rebooting the host machine.

Hadoop on Windows using HDP

We all know that Hadoop is a framework that enables the distributed processing of large datasets across the clusters of commodity hardware. HDP is HortonWorks Data Platform which is an enterprise grade and hardened hadoop distribution.HDP contains the most useful and stable version of Apache hadoop and its related projects into single tested and certified package.Using HDP, we can install hadoop on windows.


  • Microsoft Visual C++
  • Microsoft .Net framework4.0
  • java 1.6
  • Python 2.7

Note : After installing java and python , Set environment variables accordingly.

Firewall Configuration

For the communication between Clients and service components, HDP uses multiple ports.So we have to open the ports accordingly.

[code lang="shell"]
netshadvfirewall firewall add rule name=AllowRPCCommunicationdir=in action=allow protocol=TCP localport=$PORT_NUMBER

Pre-Installation steps

Create a text file which describes the hadoop components.This text file contains the hostname and other properties of hadoop components.


  • Ensure that all properties in the text file are separated by the new line character.
  • Ensure that the directory paths do not contain any whitespace character

Example of a text file(here clusterpProperties.txt) file as shown below.

[code lang="shell"]
#Log directory
HDP_LOG_DIR=&lt;Path to Log directory&gt;
#Data directory
HDP_DATA_DIR=&lt;Path to Data directory&gt;
NAMENODE_HOST=&lt;Hostname of namenode machine&gt;
SECONDARY_NAMENODE_HOST=&lt;Hostname of secondary namenode machine&gt;
JOBTRACKER_HOST=&lt;Hostname of Jobtracker machine&gt;
HIVE_SERVER_HOST=&lt;Hostname of Hive server machine&gt;
OOZIE_SERVER_HOST=&lt;Hostname of Oozie server machine&gt;
WEBHCAT_HOST=&lt;Hostname of server machine&gt;
FLUME_HOSTS=&lt;Hostname of server machine&gt;
HBASE_MASTER=&lt;Hostname of Hbase master&gt;
HBASE_REGIONSERVERS=&lt;Hostname of Hbaseregionserver&gt;
ZOOKEEPER_HOSTS=&lt;Hostname of zookeeper machines&gt;
SLAVE_HOSTS=&lt;Hostname of slave machines&gt;
#Database host
DB_HOSTNAME=&lt;Hostname of server machine&gt;
#Hive properties
HIVE_DB_NAME=&lt;Hive Database name&gt;
HIVE_DB_USERNAME=&lt;Database username&gt;
HIVE_DB_PASSWORD=&lt;Database password&gt;
#Oozie properties
OOZIE_DB_NAME=&lt;oozie database name&gt;
OOZIE_DB_USERNAME=&lt;oozie database username&amp;gt&gt;
OOZIE_DB_PASSWORD=&lt;oozie database password&amp;gt&gt;



In command prompt, we have to execute the installation command for HDP

[code lang="shell"]
HDP_DIR="&lt;$PATH_to_HDP_Install_Dir&gt;" DESTROY_DATA="&lt;Yes_OR_No&gt;"

for example

[code lang="shell"]
msiexec/i"D:\HDPINSTALLATION\hdp-\hdp-\hdp-" /lv "D:\HDP\log\installer.log" HDP_LAYOUT="D:\HDPINSTALLATION\hdp-\hdp-\clusterproperties.txt" HDP_DIR="D:\HDP\hdp_wd" DESTROY_DATA="no"

After the installation, a pop-up window will appear to indicate the installation completion.

Start HDP components

  • cd <Path to HDP directory>
  • start_local_hdp_services

Alternatively we can start these daemons from the services console of windows operating system.

Execute a Mapreduce job

To run a mapreduce job, we have to execute one command ‘Run-SmokeTests.cmd’

  • Run-SmokeTests.cmd

Cloudera Sentry – Authorization Mechanisms in Hadoop

Cloudera Sentry is an authorization mechanism in hadoop. Normally many peoples are confused between authorization and authentication.

So what is the difference between authentication and authorization???

Authentication verifies “who you are“. authentication is the mechanisms where systems may identified their users. 

Authorization means “what you are authorized to do“. In other words authorization is the mechanisms by which a system determines what level of access a particular(authenticated) user should have to resource controlled by the system.

Authorization is happening after a successful authentication.

Cloudera sentry is a cloudera based product which used for authorization mechanisms in hadoop.Now sentry is a fine grained authorization for hive-server2 and impala.

Features of Sentry :

1.) Secure Authorization – Using cloudera sentry, we can control  access to data and provide privileges on data for authenticated users.

2.)Fine-grained authorization – Using cloudera sentry, we can provide access/restrictions on databases, tables and views.we can provide permissions in particular rows/columns in a particular table

3.) Role based authorization – Authorization based on functional roles.which means a normal user can access a limited number of files.but a super user or admin user can access to many files or databases.

How to run multiple Tomcat instances in one server

Last week, i install multiple tomcat instances in one server.Usually most of the services are listening to single port.which means in a machine, one tomcat instance will listen one port.So for running multiple Tomcat instances in a single server, we have to change the ports.The steps are given below

1.) Download three tomcat instances and unpack it in three different folders.

2.) Then edit WEBSERVER_HOME/conf/server.xml file individually.

for eg.

The first Tomcat is in the location /opt/Ajith/Tomcat (This is the WEBSERVER_HOME).

edit WEBSERVER_HOME/conf/server.xml

when we unpack the tomcat, the server.xml will look like this

[code lang="shell"]

&lt;Connector port="10090" protocol="HTTP/1.1"


redirectport="8443"&nbsp; /&gt;


As i explained earlier, No two tomcat server(or any other server) will not  listen/run in same port.

So we have to change the ports accordingly.

[code lang="shell"]

&lt;Connector port="10030" protocol="HTTP/1.1"


redirectport="8553"&nbsp; /&gt;


3.) Then restart the tomcat.

4.) But most of the cause it will not start.Because we have to change some more ports on server.xml .

So we have to change “shutdown port” and “AJP” port.

[code lang="shell"]

&lt;Server port="8005" shutdown="SHUTDOWN"&gt;


&lt;Connector port="8010" protocol="AJP/1.3" redirectport="8553" /&gt;


Note:Make sure that the redirect port should be same in one tomcat server.xml(in this cause 8553″

5.)Restart the tomcat

Repeat the steps in other tomcat with different ports which is not used in that machine.

HBase Installation on Linux Machine

Apache HBase is a distributed, scalable, bigdata store.Actually it is the Hadoop database.Apache HBase is the subproject of the Apache Hadoop project and is used to provide real-time read and write access to your bigdata.HBase runs on top of HDFS(Hadoop Distributed File System).

Before installing HBase, we have to install Hadoop and zookeeper.The zookeeper cluster act as a coordination service for entire HBase cluster.For Single node HBase installation, the zookeeper is installed and started automatically.

For HBase development, selecting Hadoop version is very critical. The Hadoop version should be compactable with HBase version. Here we are using HBase-0.94.x, HBase requires hadoop-1.0.3 at a minimum.

Basic Prerequisites

This section lists required services and some required system configuration.

Software’s required

  • java JDK

As of now the recommended and tested versions of java for Hadoop and HBase installation include

Oracle jdk 1.6(u 20,21,26,28,31)

Hadoop requires java1.6+. It is built and tested on Oracle java, which is the only “supported” JVM.

  • The latest stable version of Hadoop 1.x.x( here we are using the current stable version of hadoop-1.0.3)
  • The latest stable version of HBase-0.9x.x( here we are using the current stable version of HBase-0.94.x)

Before Installing HBase, we have to install Hadoop and Zookeeper.

Installing HBase

HBase is a Distributed, non-relational and open source database. One of the key value store type database is HBase which runs over Hadoop architecture and Hdfs file system.

Step 1:  Copy the HBase tar in a particular location and untar it.We are using hbase-0.94.x.tar.gz

cd /home/hduser/Utilities

tar -xzvf hbase-0.94.x.tar.gz

Step 2: Edit the /home/hduser/Utilities/hbase/conf/ and define the $JAVA_HOME

nano /hbase/conf/

HBASE_MANAGES_ZK needs to be set as ‘true’ to use zookeeper.If it is set as false, HBase will not consider zookeeper.

export HBASE_MANAGES_ZK=true

Step 3: Edit the hbase-site.xml

A typical hbase-site.xml is given below

[code lang="shell"]







&lt;name&gt;hbase.cluster.distributed &lt;/name&gt;




&lt;value&gt;&lt;ipaddress of the zookeeper installed system&gt;&lt;/value&gt;





&lt;description&gt;The host and port that HBase master runs&lt;/description&gt;




The Value of ‘hbase.rootdir’ is the hostname and port number of system where namenode is running.(The port number should be same as that of core-site.xml, where namenode is running)

we have to create a folder in hdfs to store HBase data( This folder should mention in ‘hbase.rootdir’ value

hadoop fs -ls /

hadoop fs -mkdir /hbase

For multinode HBase installation,the property ‘hbase.zookeeper.quorum’ is important.the property is used to identify the zookeeper installed system.

  • To start HBase daemons


  • To stop HBase daemons


The default UI port of HBase is 60010.The UI of HBase can view by

http://<IP address of the system :60010>

Page 1 of 2