一:Hue简介及核心功能描述
Hue是一个开源的Apache Hadoop UI系统,由Cloudera Desktop演化而来,最后Cloudera公司将其贡献给Apache基金会的Hadoop社区,它是基于Python Web框架Django实现的。
通过使用Hue我们可以在浏览器端的Web控制台上与Hadoop集群进行交互来分析处理数据,例如操作HDFS上的数据,运行MapReduce Job,执行Hive的SQL语句,浏览HBase数据库等等。
核心功能
- SQL编辑器,支持Hive, Impala, MySQL, Oracle, PostgreSQL, SparkSQL, Solr SQL, Phoenix…
- 搜索引擎Solr的各种图表
- Spark和Hadoop的友好界面支持
- 支持调度系统Apache Oozie,可进行workflow的编辑、查看
HUE提供的这些功能相比Hadoop生态各组件提供的界面更加友好,但是一些需要debug的场景可能还是需要使用原生系统才能更加深入的找到错误的原因。
HUE中查看Oozie workflow时,也可以很方便的看到整个workflow的DAG图,不过在最新版本中已经将DAG图去掉了,只能看到workflow中的action列表和他们之间的跳转关系,想要看DAG图的仍然可以使用oozie原生的界面系统查看。
二:HUE的编译及安装部署
hue的压缩包下载之后,需要进行二次的编译才能使用
1、下载依赖包 hue-3.7.0-cdh5.3.6.tar.gz
2、检测系统中的依赖包
-》rpm -qa | grep ****
3、安装命令
sudo yum install ant asciidoc cyrus-sasl-devel gcc gcc-c++ krb5-devel libtidy libxm12-devel libxslt-devel mvn mysql-devel openldap-devel python-devel sqlite-devel openssl-devel -y
Hue安装部署
1、解压
-》$ tar -zxf hue-3.7.0-cdh5.3.6.tar.gz -C /opt/cdh5/
2、二次编译
-》在hue的主目录下执行make apps进行编译
3、修改配置文件 在desktop/conf目录下
secret_key=jFE93j;2[290-eiw.KEiwN2s3['d;/.q[eIW^y#e=+Iei*@Mn<qW5o
http_host=bigdata-01.yushu.com
http_port=8888
time_zone=Asia/Shanghai
4、启动hue 在hue主目录执行下面命令
build/env/bin/supervisor
5、外部浏览器:http://bigdata-01.yushu.com:8888
6、创建hue账户和密码
四、hue与各个组件进行关联
1、hue与hadoop进行集成
-》分为两部分:HDFS&YARN
-》修改hdfs-site.xml
<property>
<name>dfs.webhdfs.enabled</name>
<value>true</value>
</property>
-》修改core-site.xml
<property>
<name>hadoop.proxyuser.hue.hosts</name>
<value>*</value>
</property>
<property>
<name>hadoop.proxyuser.hue.groups</name>
<value>*</value>
</property>
-》重启HDFS
-》修改hue.ini
fs_defaultfs=hdfs://bigdata-01.yushu.com:8020
# NameNode logical name.
## logical_name=
# Use WebHdfs/HttpFs as the communication mechanism.
# Domain should be the NameNode or HttpFs host.
# Default port is 14000 for HttpFs.
webhdfs_url=http://bigdata-01.yushu.com:50070/webhdfs/v1
# Change this if your HDFS cluster is Kerberos-secured
## security_enabled=false
# Default umask for file and directory creation, specified in an octal value.
## umask=022
# Directory of the Hadoop configuration
hadoop_conf_dir=/opt/cdh5/hadoop-2.5.0-cdh5.3.6/etc/hadoop
hadoop_hdfs_home=/opt/cdh5/hadoop-2.5.0-cdh5.3.6
hadoop_bin=/opt/cdh5/hadoop-2.5.0-cdh5.3.6
-》保存文件,重启hue ctrl D后 build/env/bin/supervisor
-》yarn集成
-》修改hue.ini
resourcemanager_host=bigdata-01.yushu.com
# The port where the ResourceManager IPC listens on
resourcemanager_port=8032
# Whether to submit jobs to this cluster
submit_to=True
# Resource Manager logical name (required for HA)
## logical_name=
# Change this if your YARN cluster is Kerberos-secured
## security_enabled=false
# URL of the ResourceManager API
resourcemanager_api_url=http://bigdata-01.yushu.com:8088
# URL of the ProxyServer API
proxy_api_url=http://bigdata-01.yushu.com:8088
# URL of the HistoryServer API
history_server_api_url=http://bigdata-01.yushu.com:19888
-》保存文件,重启hue
HUE可以很方便的浏览HDFS中的目录和文件,并且进行文件和目录的创建、复制、删除、下载以及修改权限等操作。
HDFS实现了一个和POSIX系统类似的文件和目录的权限模型。每个文件和目录有一个所有者(owner)和一个组(group)。文件或目录对其所有者、同组的其他用户以及所有其他用户分别有着不同的权限。但,用户身份机制对HDFS本身来说只是外部特性。HDFS并不提供创建用户身份、创建组或处理用户凭证等功能。 使用HUE访问HDFS时,HDFS简单的将HUE上的用户名和组的名称进行权限的校验。
2、hue与hive进行集成1、hive多种链接元数据方式
-》默认Derby数据库
-》本地mysql
-》远程mysql
-》过程:
client-》hiveserver2
hiveserver2-》远程metastore-》mysql元数据
元数据-》hiveserver2-》client
<property>
<name>hive.metastore.uris</name>
<value></value>
<description>Thrift URI for the remote metastore. Used by metastore client to connect to remote metastore.</description>
</property>
如果hive已经配置元数据服务 要启动元数据服务进程 bin/hive --service metastore
2、hiveserver2两种数据传输方式
-》10000binary
-》10001http
3、启动hiveserver2 bin/hiveserver2
4、修改hue.ini
# Host where HiveServer2 is running.
# If Kerberos security is enabled, use fully-qualified domain name (FQDN).
hive_server_host=bigdata-01.yushu.com
# Port where HiveServer2 Thrift server runs on.
hive_server_port=10000
# Hive configuration directory, where hive-site.xml is located
hive_conf_dir=/opt/cdh5/hive-0.13.1-cdh5.3.6/conf/
-》保存文件,重启hue
HUE的beeswax app提供友好方便的Hive查询功能,能够选择不同的Hive数据库,编写HQL语句,提交查询任务,并且能够在界面下方看到查询作业运行的日志。在得到结果后,还提供进行简单的图表分析能力。
3、hue与RDBMS进行集成
-》修改hue.ini
[[databases]]
# sqlite configuration.
[[[sqlite]]]
# Name to show in the UI.
nice_name=SQLite
# For SQLite, name defines the path to the database.
name=/opt/cdh5/hue-3.7.0-cdh5.3.6/desktop/desktop.db
# Database backend to use.
engine=sqlite
-》保存文件,重启hue
-》关联mysql
-》修改hue.ini
[[[mysql]]]
# Name to show in the UI.
nice_name="My SQL DB"
# For MySQL and PostgreSQL, name is the name of the database.
# For Oracle, Name is instance of the Oracle server. For express edition
# this is 'xe' by default.
## name=mysqldb
# Database backend to use. This can be:
# 1. mysql
# 2. postgresql
# 3. oracle
engine=mysql
# IP or hostname of the database to connect to.
host=bigdata-01.yushu.com
# Port the database server is listening to. Defaults are:
# 1. MySQL: 3306
# 2. PostgreSQL: 5432
# 3. Oracle Express Edition: 1521
port=3306
# Username to authenticate with when connecting to the database.
user=root
# Password matching the username to authenticate with when
# connecting to the database.
password=123456
-》保存文件,重启hue
4、hue与oozie进行集成
-》修改oozie-site.xml
<property>
<name>oozie.service.WorkflowAppService.system.libpath</name>
<value>/user/oozie/share/lib</value>
<description>
System library path to use for workflow applications.
This path is added to workflow application if their job properties sets
the property 'oozie.use.system.libpath' to true.
</description>
</property>
-》手动创建sharelib
-》先关闭oozie再创建
bin/oozie-setup.sh sharelib create -fs hdfs://bigdata-01.yushu.com:8020 -locallib oozie-sharelib-4.0.0-cdh5.3.6-yarn.tar.gz
-》修改hue.ini
[liboozie]
# The URL where the Oozie service runs on. This is required in order for
# users to submit jobs. Empty value disables the config check.
oozie_url=http://bigdata-01.yushu.com:11000/oozie
-》保存文件,重启hue,以及启动oozie
HUE也提供了很好的Oozie的集成,能够在HUE上创建和编辑Bundles, Coordinator, Workflow. Oozie的介绍可以去官网查看。可以在HUE上创建一个新的workflow,在该界面上,可以直接拖动不同的组件,变成DAG中的节点,并且设置各个action的流转逻辑。当然Oozie也可以通过命令行的方式提交B,C,W. 不过是使用HUE创建的workflow,或者是通过命令行提交的workflow,都可以在HUE上查看运行的状况。