Apache Ambari on ARM64


Overview:

In this blog we try to explain about Ambari and its uses, Status of the Ambari on ARM64.

Apache Ambari is an open source administration tool deployed on top of Hadoop cluster and responsible for keeping track of running applications and their status. Apache Ambari can be referred to as an open source web-based management tool that manages, monitors and provisions the health of Hadoop clusters.

The Apache Ambari is currently one of the leading projects running under Apache Software Foundation.  The reason is that Ambari eliminates the need for manual tasks used to watch over Hadoop operations. It gives a simple secure platform for provisioning, managing and monitoring Hortonworks Data Platform (HDP) deployments. 

How Apache Ambari came into existence 

The genesis of Apache Ambari traces the emergence of Hadoop when its distributed and scalable computing took the world by storm. More and more technologies were incorporated in the existing infrastructure. Gradually Hadoop matured and it became difficult for the cluster to maintain multiple nodes and applications simultaneously. That is when this technology came into picture to make distributed computing easier.
  • It's a completely open source management platform for provisioning, managing, monitoring and securing Apache Hadoop clusters. 
  • Apache Ambari takes the guesswork out of operating Hadoop.
  • Apache Ambari, as part of the Hortonworks Data Platform, allows enterprises to plan, install and securely configure HDP making it easier to provide ongoing cluster maintenance and management, no matter the size of the cluster.
Ambari ARM64 porting efforts

We (BigData team) in Linaro are trying to port the Ambari on ARM64 and upstream all the patches.  But as you know the upstream process takes it's own time to complete.  In first place we are trying to compile and generate the RPM/DEB packages on standard distribution.  The compilation steps for Ambari can be found here - Ambari Compilation But you need couple of patches to get it compiled on ARM64 Ambari The patches basically does the following
  • Replace needarch variable hard coding of x86_64.
  • Replace npm/Node version in your distribution. 
  • The phantomjs versions which is having AArch64 support.
  • Use the ember-handlebars-brunch version which has got ARM64 support.
  • Replace hardcoded amd64 values for deb.architecture variable.
  • The RPM/JDEB support patches for couple of missing packages.
The Ambari do not have any AArch64 bits, It has x86 bits hard coded in all places.  We have fixed it from v2.5 and used bigtop to make the build then wrote mpack (Management pack) specs and  used bigtop as mpack.  We have created a collaborate page to Build and Install the v2.6.1 Ambari. If you want to build different version, It may be required to slightly tweak the patches depending on the version which you want to build.  These patches you may find on our linaro git repositories.

Build/Install/Run Apache Ambari

In this section we try to explain example v2.6.1 Apache Ambari build from scratch on both CentOS and Debian/Ubuntu machines.  The versions are very important The latest version build method will be almost similar with some minor changes.  To build latest version of the Ambari use my git repository on git.linaro.org.  The repository usually up to date with patches here are usually forward ported.

Sources

Setup Environment

  • Debian 9.0 64bit for AArch64, or CentOS-7.4 64bit for AArch64
  • jdk8u-server-release-1804

Pre-Requisites

jdk8u-server-release-1804

Dependencies

maven@v3.5.3, nodejs@v4.2.6, npm@2.14.12, brunch@1.7.10, phantomjs@2.1.1, python>=2.6, python-dev, rpm, yum, g++

Build Steps

Install Pre-requisities

For Debian 9.0:

sudo apt install git python python-dev rpm yum build-essential libfreetype6 libfreetype6-dev fontconfig fontconfig-config libfontconfig1-dev libssl-dev openssl findbugs -y

For CentOS7

sudo yum groupinstall "Development Tools"
sudo yum install git python python-devel openssl-devel openssl openssl-libs freetype freetype-devel fontconfig-devel fontconfig gcc gcc-c++ make build autoconf automake cppunit-devel cmake bzip2 rpm-build

Setup maven

To setup maven 3.5.3

wget http://www-eu.apache.org/dist/maven/maven-3/3.5.3/binaries/apache-maven-3.5.3-bin.tar.gz
tar xvf apache-maven-3.5.3-bin.tar.gz
cd apache-maven-3.5.3/bin
export PATH=$PWD:$PATH

Make sure the version of Maven is 3.5.3 when the following command is issued.
mvn --version

Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T19:49:05Z)
Maven home: /home/centos/maven/apache-maven-3.5.3
Java version: 1.8.0-release, vendor: Oracle Corporation
Java home: /home/centos/jdk8u/jdk8u-server-release-1804/jre
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux", version: "4.12.0-1.1.aarch64", arch: "aarch64", family: "unix"

Setup python tools

  • For python 2.6, download
    wget http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg#md5=bfa92100bd772d5a213eedd356d64086
    sudo sh setuptools-0.6c11-py2.6.egg

  • For python 2.7, download
    wget https://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg#md5=fe1f997bc722265116870bc7919059ea
    sudo sh setuptools-0.6c11-py2.7.egg
     
    The python 2.6 did't work for me, hence I have just created a softlink of v2.6 for v2.7 python
     
    $ sudo ln -s /usr/bin/python2.7 /usr/bin/python2.6

Setup nodejs/npm

Nodejs and npm come with different versions along with Ubuntu/Debian

Ubuntu/Debian, nodejs/npm can be installed by:

sudo apt-get install -y nodejs npm
cd /usr/bin && sudo ln -s nodejs node
sudo npm install -g brunch@1.7.10
 
Note that if you are using Debian 9 stretch then please follow the below steps https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions
sudo apt-get install curl
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs
cd /usr/bin && sudo ln -s nodejs node
sudo npm install -g brunch@1.7.10

CentOS7, nodejs/npm need to be built from source.
git clone https://github.com/nodejs/node.git
cd node
git checkout -b 4.2.6 v4.2.6
./configure --prefix=/usr && make -j8
sudo make install
sudo npm install -g brunch@1.7.10

The version of built out binaries are: nodejs@v4.2.6, npm@2.14.12.
As long as they are installed, pom.xml in ambari-admin needs to be changed to reflect these versions. The target nodejs/npm version are defined in "configuration" field of "frontend-maven-plugin".

Build PhantomJS

The following steps explain about AArch64 supported phantomjs v2.1.1.  Note that you have to install all the dependency packages before you proceed further.  Refer collaborate page for PhantomJS

git clone https://github.com/ariya/phantomjs.git
cd phantomjs
git checkout -b v2.1.1 2.1.1
./build.py -c -j $(getconf _NPROCESSORS_ONLN)

When the build is finished, create tar file for deployment

cd deploy
./package.sh

You can test phantomjs build by issuing:

./bin/phantomjs test/run-tests.js
Install phantomjs-2.1.1-linux-aarch64.tar.bz2 to the system and add phantomjs to $PATH.

Check if phantomjs is properly installed by doing:

$ phantomjs --version
2.1.1

Replace frontend-maven-plugin

Ambari uses fronend-maven-plugin@v0.0.16, which doesn't support AArch64. Do following to rebuild this plugin for AArch64.

git clone https://github.com/eirslett/frontend-maven-plugin.git
cd frontend-maven-plugin
git checkout -b 0.0.16 frontend-plugins-0.0.16
git apply frontend-maven.patch
mvn clean -DskipTests install

Replace leveldbjni

levedbjni is used in Ambari-metrics. It only provides x86/x86_64 version in maven repo. So AArch64 version of leveldbjni needs to be built and installed.

wget http://pkgs.fedoraproject.org/repo/pkgs/snappy/snappy-1.0.5.tar.gz/4c0af044e654f5983f4acbf00d1ac236/snappy-1.0.5.tar.gz
tar -xf snappy-1.0.5.tar.gz
cd snappy-1.0.5
./configure --disable-shared --with-pic --host aarch64-unknown-linux --build aarch64-unknown-linux
make -j4
cd ..
git clone git://github.com/chirino/leveldb.git
git clone git://github.com/fusesource/leveldbjni.git
export SNAPPY_HOME=`cd snappy-1.0.5; pwd`
export LEVELDB_HOME=`cd leveldb; pwd`
export LEVELDBJNI_HOME=`cd leveldbjni; pwd`
cd leveldb
export LIBRARY_PATH=${SNAPPY_HOME}
export C_INCLUDE_PATH=${LIBRARY_PATH}
export CPLUS_INCLUDE_PATH=${LIBRARY_PATH}
git apply ../leveldbjni/leveldb.patch
wget https://raw.githubusercontent.com/google/leveldb/master/port/atomic_pointer.h -O port/atomic_pointer.h
make libleveldb.a
cd ${LEVELDBJNI_HOME}
git checkout -b 1.8 leveldbjni-1.8
mvn clean install -P all -P linux64 -DskipTests=true

Build Ambari

To build Ambari, a certain version number should be provided. This version number IS 5-DIGITS, not "4-digits" mentioned on Ambari's Wiki Page. The last digit may vary but the first 3 digits should be same as Ambari source/release version. In our case this is 2.6.1. Patch is provided to make Ambari built on AArch64.  Apply all the patches before you are going for the build. You can directly clone and build my AMBARI git repository - https://git.linaro.org/people/naresh.bhat/apache/ambari.git

git clone https://github.com/apache/ambari.git
cd ambari
git checkout release-2.6.1
 
Download and apply following patches
 
git am 0001-ambari-build-aarch64-2.6.1.patch
git am 0002-ambari-metrics-grafana-Add-jdeb-support.patch
git am 0003-ambari-funtest-Add-jdeb-support.patch
git am 0004-ambari-logsearch-Add-jdeb-support.patch
git am 0005-ambari-Add-jdeb-arm64-support.patch
 
mvn versions:set -DnewVersion=2.6.1.0.0
pushd ambari-metrics
mvn versions:set -DnewVersion=2.6.1.0.0
popd
 
On CentOS 7.4 to generate rpm's you can issue below command.
 
mvn -B clean install package rpm:rpm -DskipTests -Dpython.ver="python >= 2.6" -Preplaceurl -Drat.ignoreErrors=true
 
On Debian 9 to generate Debian packages you can issue below command.
 
mvn -B clean install jdeb:jdeb -DnewVersion=2.6.1.0.0 -DskipTests -Dpython.ver="python >= 2.6" -Drat.ignoreErrors=true
Ambari Server will create following packages
  • RPM will be created under AMBARI_DIR/ambari-server/target/rpm/ambari-server/RPMS/aarch64.
Ambari Agent will create following packages
  • RPM will be created under AMBARI_DIR/ambari-agent/target/rpm/ambari-agent/RPMS/aarch64.
Ambari Metrics will create following packages
  • RPM will be created under  AMBARI_DIR/ambari-metrics/ambari-metrics-timelineservice/target/rpm/ambari-metrics-collector/RPMS/noarch.

Run Ambari

Ambari Server

First, install Pre-Requisities

sudo yum install postgresql
sudo yum install postgresql-server

Then install the Ambari Server RPM.

sudo yum install ambari-server/target/rpm/ambari-server/RPMS/aarch64/ambari-server-*.rpm

Initialize Ambari Server:

sudo ambari-server setup

Start up Ambari Server:

sudo ambari-server start

To access Ambari, go to: http://{ambari-server-hostname}:8080

The initial username/password is admin/admin.

Ambari Agent

Install the Ambari Agent RPM.

sudo yum install ambari-agent/target/rpm/ambari-agent/RPMS/aarch64/ambari-agent-2.4.2.0-0.aarch64.rpm

Then edit the location of Ambari Server in /etc/ambari-agent/conf/ambari-agent.ini by editing the hostname line.

Start Ambari Agent:

sudo ambari-agent start

Patches submitted

Jira issues on Ambari

https://issues.apache.org/jira/browse/AMBARI-24407
https://issues.apache.org/jira/browse/AMBARI-23903

Git repository to track upstream activity

https://git.linaro.org/people/naresh.bhat/apache/ambari.git/

The Ambari version 2.6.1 patches can be downloaded from http://people.linaro.org/~naresh.bhat/Ambari-2.6.1-patches/

Issues/Debug

https://wiki.linaro.org/LEG/Engineering/BigData/horrible-jvm-debug-case-for-ed-ambari 


Ambari Demo on ARM64 at Linaro connect

At Budapest Linaro connect ( BUD17 ) we did a Apache Ambari demo on ARM64 - https://www.youtube.com/watch?v=64l5CM9AJi4

Upcoming activities

- Upstream Ambari ARM64 needarch support patches
- upstream
- Management pack (mpack) implementations for BigTop project



Comments

Popular posts from this blog

Benchmarking BigData

mockbuild warning in CentOS