HUE=HadoopUser Experience,看這名字就知道怎麼回事了吧,沒錯,直白來講就是Hadoop用戶體驗,是一個開源的Apache Hadoop UI系統,由Cloudera Desktop演化而來,最後Cloudera公司將其貢獻給Apache基金會的Hadoop社區,它是基於Python Web框架Django實現的。經過使用HUE咱們能夠在瀏覽器端的Web控制檯上與Hadoop集羣進行交互來分析處理數據。html
官網網站:http://gethue.com/ java
http://archive.cloudera.com/cdh5/cdh/5/hue-3.7.0-cdh5.3.0/manual.html node
打開官方網站能夠找到對應的部署HUE所需的各類依賴列表,以下圖所示:python
如上圖所示,這部份內容是告訴你,安裝編譯Hue須要依賴哪些Linux安裝包,你只須要使用yum命令一次安裝就能夠了,在此給你們整理好該命令(注意使用root權限安裝):mysql
# yum -y install ant asciidoc cyrus-sasl-devel cyrus-sasl-gssapi gcc gcc-c++ krb5-devel libtidy libxml2-devel libxslt-devel openldap-devel python-devel sqlite-devel openssl-devel mysql-devel gmp-devel
(尖叫提示:使用yum安裝這些包的同時,也會自動安裝openJDK的依賴,因此,請自行刪除安裝後的openJDK,忘記的同窗請參考Linux基礎)c++
(查詢:# rpm -qa | grep java)web
(刪除:# rpm -e --nodeps xxxxxxx-java-xxxx.rpm)sql
$ tar -zxf /opt/softwares/hue-3.7.0-cdh5.3.6.tar.gz -C /opt/modules/cdh/
到hue安裝目錄下,執行make appsapi
$ make apps
尖叫提示:使用普通用戶編譯瀏覽器
大概等個幾分鐘以後,就編譯成功了。
修改Hue.ini文件
文件位置:/opt/modules/cdh/hue-3.7.0-cdh5.3.6/desktop/conf/hue.ini
其中的secret_key請參照官方網站配置:
修改內容參照以下:
完成以後呢,保存退出,咱們來使用命令啓動Hue$ build/env/bin/supervisor,出現以下界面表示啓動成功:
接下來使用瀏覽器來查看hue界面:http://hadoop-senior01.itguigu.com:8888,接着咱們就看到以下界面:
這句話是在提示你,第一次使用本工具,須要建立一個用戶及密碼,且會成爲hue的超級用戶憑證,在此呢,我設置爲admin用戶名,密碼隨意,那就123456吧,而後呢就能夠見到以下界面了:
添加
屬性:dfs.webhdfs.enabled
屬性值:true
解釋:Enable WebHDFS (REST API) in Namenodes and Datanodes.
添加
屬性:hadoop.proxyuser.hue.hosts
變動爲:hadoop.proxyuser.admin.hosts
屬性值:*
解釋:代理的用戶
屬性:hadoop.proxyuser.hue.groups
變動爲:hadoop.proxyuser.admin.groups
屬性值:*
解釋:代理的用戶組
若是你的Hadoop配置了高可用,則必須經過httpfs來訪問,須要添加以下屬性,反則則沒必要須。(若是HUE服務與Hadoop服務不在同一節點,則必須配置)
屬性:hadoop.proxyuser.hue.hosts
變動爲:hadoop.proxyuser.httpfs.hosts
屬性值:*
屬性:hadoop.proxyuser.hue.groups
變動爲:hadoop.proxyuser.httpfs.groups
屬性值:*
添加
屬性:httpfs.proxyuser.hue.hosts
屬性值:*
屬性:httpfs.proxyuser.hue.groups
屬性值:*
解釋:以上兩個屬性主要用於HUE服務與Hadoop服務不在同一臺節點上所必須的配置。
尖叫提示:
* 若是沒有配置NameNode的HA,HUE能夠用WebHDFS來管理HDFS
* 若是配置了NameNodeHA,則HUE只可用HttpFS來管理HDFS
$ scp -r etc/ hadoop-senior02.itguigu.com:/opt/modules/cdh/hadoop-2.5.0-cdh5.3.6/
$ scp -r etc/ hadoop-senior03.itguigu.com:/opt/modules/cdh/hadoop-2.5.0-cdh5.3.6/
$ /opt/modules/cdh/hadoop-2.5.0-cdh5.3.6/sbin/httpfs.sh start &
找到[hadoop]標籤
$ build/env/bin/supervisor
打開HUE的頁面,進行HDFS管理。
尖叫提示:
若是提示錯誤根目錄應該歸屬於hdfs,請修改python變量,位置以下:
/opt/modules/cdh/hue-3.7.0-cdh5.3.6/desktop/libs/hadoop/src/hadoop/fs/webhdfs.py
修改其中的變量值爲:
DEFAULT_HDFS_SUPERUSER = 'admin'
而後重啓HUE服務便可。
尖叫提示:
啓動HUE服務時,請先kill掉以前的HUE服務,若是提示地址被佔用,請使用以下命令查看佔用8888端口的進程並kill掉:
$ netstat -tunlp | grep 8888
找到[[yarn_clusters]]標籤,修改配置以下圖所示:
$ build/env/bin/supervisor
HUE與hive集成須要hive開啓HiveServer2服務
屬性:hive.server2.thrift.port
屬性值:10000
屬性:hive.server2.thrift.bind.host
屬性值:hadoop-senior01.itguigu.com
屬性:hive.server2.long.polling.timeout
屬性值:5000
屬性:hive.metastore.uris
屬性值:thrift://hadoop-senior01.itguigu.com:9083
$ bin/hive --service metastore &
$ bin/hive --service hiveserver2 &
尖叫提示:若是設置了uris,在從此使用Hive時,那麼必須啓動如上兩個命令,不然Hive沒法正常啓動。
找到[beeswax]屬性標籤,配置如圖:
來到這樣的界面進行簡單的查詢便可測試
$ build/env/bin/supervisor
找到[[[mysql]]]標籤,並刪掉標籤註釋,配置以下:
啓動後便可測試是否成功鏈接Mysql服務,而且測試是否能夠看到數據
$ build/env/bin/supervisor
找到[liboozie]標籤以及[oozie]標籤配置以下
[liboozie]:
[oozie]:
$ bin/oozied.sh start
$ build/env/bin/supervisor
尖叫提示:若是提示沒法關聯oozie的share/lib,請使用hdfs命令建立該目錄便可:
$ bin/hdfs dfs -mkdir -p /user/oozie/share/lib
找到[hbase]標籤,修改內容如圖:
$ bin/hbase-daemon.sh start thrift
$ build/env/bin/supervisor
找到[zookeeper]標籤,配置以下:
$ build/env/bin/supervisor
尖叫提示:HUE只支持Sqoop2的集成,不支持Sqoop1,在此再也不演示。
http://archive.cloudera.com/cdh5/cdh/5/hue-3.7.0-cdh5.3.0/user-guide/sqoop.html
在此咱們總結一下集成HUE時,咱們開啓的後臺服務項
$ /opt/modules/cdh/hadoop-2.5.0-cdh5.3.6/sbin/httpfs.sh start &
$ /opt/modules/cdh/hive-0.13.1-cdh5.3.6/bin/hive --service metastore &
$ /opt/modules/cdh/hive-0.13.1-cdh5.3.6/bin/hive --service hiveserver2 &
$ /opt/modules/cdh/hbase-0.98.6-cdh5.3.6/bin/hbase-daemon.sh start thrift &
$ /opt/modules/cdh/oozie-4.0.0-cdh5.3.6/bin/oozied.sh start &
爲了方便,咱們把這些服務加在羣起腳本中,如圖所示:
完整腳本以下:
#!/bin/bash
echo "===================================正在開啓集羣服務=======================================" echo "===================================正在開啓Zookeeper節點==================================" for i in admin@hadoop-senior01.itguigu.com admin@hadoop-senior02.itguigu.com admin@hadoop-senior03.itguigu.com do ssh $i '/opt/modules/cdh/zookeeper-3.4.5-cdh5.3.6/bin/zkServer.sh start' done echo "===================================正在開啓NameNode節點==================================" ssh admin@hadoop-senior01.itguigu.com '/opt/modules/cdh/hadoop-2.5.0-cdh5.3.6/sbin/hadoop-daemon.sh start namenode' echo "===================================正在開啓DataNode節點==================================" for i in admin@hadoop-senior01.itguigu.com admin@hadoop-senior02.itguigu.com admin@hadoop-senior03.itguigu.com do ssh $i '/opt/modules/cdh/hadoop-2.5.0-cdh5.3.6/sbin/hadoop-daemon.sh start datanode' done echo "===================================正在開啓SeondaryNameNode節點==========================" ssh admin@hadoop-senior03.itguigu.com '/opt/modules/cdh/hadoop-2.5.0-cdh5.3.6/sbin/hadoop-daemon.sh start secondarynamenode' echo "===================================正在開啓ResourceManager節點===========================" ssh admin@hadoop-senior02.itguigu.com '/opt/modules/cdh/hadoop-2.5.0-cdh5.3.6/sbin/yarn-daemon.sh start resourcemanager' echo "===================================正在開啓NodeManager節點===============================" for i in admin@hadoop-senior01.itguigu.com admin@hadoop-senior02.itguigu.com admin@hadoop-senior03.itguigu.com do ssh $i '/opt/modules/cdh/hadoop-2.5.0-cdh5.3.6/sbin/yarn-daemon.sh start nodemanager' done echo "===================================正在開啓JobHistoryServer節點==========================" ssh admin@hadoop-senior01.itguigu.com '/opt/modules/cdh/hadoop-2.5.0-cdh5.3.6/sbin/mr-jobhistory-daemon.sh start historyserver' echo "===================================正在開啓HBase節點=====================================" ssh admin@hadoop-senior01.itguigu.com '/opt/modules/cdh/hbase-0.98.6-cdh5.3.6/bin/start-hbase.sh' echo "===================================正在第1節點開啓httpfs服務==============================" ssh admin@hadoop-senior01.itguigu.com '/opt/modules/cdh/hadoop-2.5.0-cdh5.3.6/sbin/httpfs.sh start &' echo "===================================正在第1節點開啓metastore與hiveserver2服務==============" ssh admin@hadoop-senior01.itguigu.com '/opt/modules/cdh/hive-0.13.1-cdh5.3.6/bin/hive --service metastore &' ssh admin@hadoop-senior01.itguigu.com '/opt/modules/cdh/hive-0.13.1-cdh5.3.6/bin/hive --service hiveserver2 &' echo "===================================正在第1節點開啓HBase thrift服務========================" ssh admin@hadoop-senior01.itguigu.com '/opt/modules/cdh/hbase-0.98.6-cdh5.3.6/bin/hbase-daemon.sh start thrift &' echo "===================================正在第1節點開啓Oozie服務===============================" ssh admin@hadoop-senior01.itguigu.com '/opt/modules/cdh/oozie-4.0.0-cdh5.3.6/bin/oozied.sh start &' echo "===================================正在第1節點開啓HUE服務=================================" ssh admin@hadoop-senior01.itguigu.com '/opt/modules/cdh/hue-3.7.0-cdh5.3.6/build/env/bin/supervisor &'