Skip to content

Instantly share code, notes, and snippets.

@tilakpatidar
Last active October 30, 2018 19:05
Show Gist options
  • Save tilakpatidar/546f4eda2c653b4d8fe90867b92e1276 to your computer and use it in GitHub Desktop.
Save tilakpatidar/546f4eda2c653b4d8fe90867b92e1276 to your computer and use it in GitHub Desktop.
Install HUE on HDP

Install HUE on HDP

Prerequisites

Install required packages

yum install -y ant gcc g++ libkrb5-dev libmysqlclient-dev
yum install -y libssl-dev libsasl2-dev libsasl2-modules-gssapi-mit
yum install -y libsqlite3-dev libtidy-0.99-0 libxml2-dev libxslt-dev
yum install -y maven libldap2-dev python-dev python-simplejson python-setuptools
yum install -y libxslt-devel libxml++-devel libxml2-devel libffi-devel
yum install -y asciidoc cyrus-sasl-devel cyrus-sasl-gssapi cyrus-sasl-plain gcc gcc-c++ krb5-devel make mysql mysql-devel openldap-devel python-devel sqlite-devel gmp-devel

Prepare PostgreSQL

CREATE DATABASE hue;
CREATE USER hue WITH PASSWORD 'bigdata';
GRANT ALL PRIVILEGES ON DATABASE hue TO hue;
CREATE SCHEMA hue AUTHORIZATION hue;
ALTER SCHEMA hue OWNER TO hue;
ALTER ROLE hue SET search_path to 'hue', 'public';

Allow connections from hue server to postgresql.

echo "hostnossl    hue             hue             192.168.120.1/21            md5" >> /var/lib/pgsql/data/pg_hba.conf

Create hue user

adduser hue

Install HUE service on ambari

To install HUE as a service in HDP we followed the following guide. However, the steps are also given below.

VERSION=`hdp-select status hadoop-client | sed 's/hadoop-client - \([0-9]\.[0-9]\).*/\1/'`
rm -rf /var/lib/ambari-server/resources/stacks/HDP/$VERSION/services/HUE  
git clone https://github.com/EsharEditor/ambari-hue-service.git /var/lib/ambari-server/resources/stacks/HDP/$VERSION/services/HUE
ambari-server restart

This service has some issues with new version of hue and hdp. The following patches has to be applied before starting the installation.

vi /var/lib/ambari-agent/cache/stacks/HDP/2.6/services/HUE/package/scripts/params.py

In the above file change download_url to

download_url = 'echo http://gethue.com/downloads/releases/4.0.1/hue-4.0.1.tgz'

This service also forgets to compile the hue before moving to /usr/local/hue.

vi /var/lib/ambari-agent/cache/stacks/HDP/2.6/services/HUE/package/scripts/common.py

In above file find download_hue() method and change it.

def download_hue():
  import params
  """
  Download Hue to the installation directory
  """
  Execute('{0} | xargs wget -O hue.tgz'.format(params.download_url))
  Execute('tar -zxvf hue.tgz')
  Execute('rm -f hue.tgz'.format(params.hue_install_dir))
  Execute('mv hue-4.0.0 hue')
  Execute('cd hue && make install')
  # Ensure all Hue files owned by hue
  Execute('chown -R {0}:{1} {2}'.format(params.hue_user,params.hue_group,params.hue_dir))
  Execute('ln -s {0} /usr/hdp/current/hue-server'.format(params.hue_dir))
  Logger.info("Hue Service is installed")

This service also forgets to use UTF-8 as default encoding.

vi /usr/lib/python2.6/site-packages/resource_management/core/sudo.py

In above file after imports add the following lines.

import sys
reload(sys)
sys.setdefaultencoding('utf-8')
If HTTPS is enabled and PORT is different

Go and edit this file vi /var/lib/ambari-agent/cache/stacks/HDP/2.6/services/HUE/package/files/configs.sh. Change the SSL_PREFIX to s and PORT to the desired port.

Deploy Hue service on ambari

Now, go to ambari server and find add service. Add the hue service with postgresql as metastore. Provide jdbc credentials as configured in postgresql for hue user. Once, the deploy is finished go to hue tab in ambari. Go to service actions and select metastoresync. This prepares the metastore db for hue. Also, advanced configuration can be found at /usr/local/hue/desktop/conf/hue.ini.

Add service URLs in the above conf file. Visit resource 1 for more details.

Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment