Ambari service for easily installing and managing Hue on HDP cluster.
Authors:
- anu: Hue Install/Config/Start/Stop via Ambari
- Hue v3.11.0+
- Ambari v2.4.0+
-
(Optional) To see Hue metrics in Ambari, login to Ambari (admin/admin) and start Ambari Metrics service http://$AMBARI_HOST:8080
-
To download the Hue service folder, run 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
sudo git clone https://github.com/gaoxuapple/ambari-hue-service.git /var/lib/ambari-server/resources/stacks/HDP/$VERSION/services/HUE
-
From this link(http://gethue.com/downloads/hue-3.11.0.tgz) download Installation package.
-
Edit Hue params(/var/lib/ambari-server/resources/stacks/HDP/$VERSION/services/HUE/package/scripts/params.py) like this:,
32 download_url = 'echo http://anua/ambari/hue/hue-3.11.0.tgz'
33 hue_version_dir = 'hue-3.11.0'
- Restart Ambari
service ambari-server restart
- Then you can click on 'Add Service' from the 'Actions' dropdown menu in the bottom left of the Ambari dashboard:
On bottom left -> Actions -> Add service -> check Hue server -> Next -> Next -> Change any config you like (e.g. install dir, port) -> Next -> Deploy
-
Also ensure that the install location you are choosing (/usr/local/hue by default) does not exist
-
If installation fails, please recompile the installation package manually.
rm -rf /usr/local/hue
mkdir /usr/local/hue
cd /usr/local
wget http://gethue.com/downloads/hue-3.11.0.tgz
tar -zxvf hue-3.11.0.tgz
cd hue-3.11.0
make install
chown -R hue:hue /usr/local/hue
chomd -R +x /usr/local/hue
After successful compilation, please restart hue.
-
On successful deployment you will see the Hue service as part of Ambari stack and will be able to start/stop the service from here:
-
You can see the parameters you configured under 'Configs' tab
-
One benefit to wrapping the component in Ambari service is that you can now monitor/manage this service remotely via REST API
export SERVICE=HUE
export PASSWORD=admin
export AMBARI_HOST=localhost
export CLUSTER=DCenter
#get service status
curl -u admin:$PASSWORD -i -H 'X-Requested-By: ambari' -X GET http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER/services/$SERVICE
#start service
curl -u admin:$PASSWORD -i -H 'X-Requested-By: ambari' -X PUT -d '{"RequestInfo": {"context" :"Start $SERVICE via REST"}, "Body": {"ServiceInfo": {"state": "STARTED"}}}' http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER/services/$SERVICE
#stop service
curl -u admin:$PASSWORD -i -H 'X-Requested-By: ambari' -X PUT -d '{"RequestInfo": {"context" :"Stop $SERVICE via REST"}, "Body": {"ServiceInfo": {"state": "INSTALLED"}}}' http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER/services/$SERVICE
Hue uses a configuration file to understand information about Hadoop cluster and where to connect to. We’ll need to configure our Hadoop cluster to accept connections from HUE, and add our cluster information to the HUE configuration file. We’ll need to reconfigure our HDFS, Hive (WebHcatalog), and Oozie services to take advantage of HUE’s features.tutorials from Hue
- UserSync: synchronize users from the current system or Ldap server
- DatabaseSync: synchronize metastore from SQLite
- To remove the Hue service:
- Stop the service via Ambari
- Unregister the service by running below from Ambari node
export SERVICE=HUE
export PASSWORD=admin
export AMBARI_HOST=localhost
#detect name of cluster
output=`curl -u admin:$PASSWORD -i -H 'X-Requested-By: ambari' http://$AMBARI_HOST:8080/api/v1/clusters`
CLUSTER=`echo $output | sed -n 's/.*"cluster_name" : "\([^\"]*\)".*/\1/p'`
#unregister service from ambari
curl -u admin:$PASSWORD -i -H 'X-Requested-By: ambari' -X DELETE http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER/services/$SERVICE
#if above errors out, run below first to fully stop the service
#curl -u admin:$PASSWORD -i -H 'X-Requested-By: ambari' -X PUT -d '{"RequestInfo": {"context" :"Stop $SERVICE via REST"}, "Body": {"ServiceInfo": {"state": "INSTALLED"}}}' http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER/services/$SERVICE
- Remove artifacts
rm -rf /usr/local/hue*
rm -rf /var/log/hue
rm -rf /var/run/hue
rm /usr/hdp/current/hadoop-client/lib/hue-plugins-3.11.0-SNAPSHOT.jar