版权声明:本文为博主原创文章,欢迎转载,转载请注明出处。 https://blog.csdn.net/u012802702/article/details/68071244
一、首先编译Hue,并在要安装Hue的节点上创建Hue用户和hue组;
创建Hue用户
groupadd hue
useradd hue -g hue
需要注意的是hue在编译时有两种方式:
方式一:进入源码目录直接在源码目录下运行如下指令:指定安装目录并编译安装.此时会在指定的目录下创建一个hue目录并将hue的安装文件放到该目录下.
$
PREFIX=/usr/share make install
$
cd /usr/share/hue
方式二:直接在源码目录下运行:
git clone https://github.com/cloudera/hue.git
cd hue
make apps
$ build/env/bin/hue runserver
指定安装在哪个目录下,就应该在那个目录下安装,即使将其迁移到其他机器上安装,只要安装目录结构一致即可,因为在编译的时候回根据编译时指定的安装目录将绝对路径写入到Python脚本中。因此如果安装目录与编译目录不一致则会报错.
Hue 的git网址:https://github.com/cloudera/hue#development-prerequisites 其中有Hue编译所需安装的系统及其工具链的安装,
二、安装Mysql,并在Mysql中创建创建Hue库 。创建Hue用户并授予Hue用户对该Mysql的所有表的操作权限以及外部访问的权限。
登录Mysql;
mysql -uroot -p
之后输入密码登录mysql
创建hue数据库:
CREATE DATABASE hue;
创建hue用户:
CREATE USER 'hue'@'%' IDENTIFIED BY 'hue';
给用户权限:并刷新信息
GRANT ALL PRIVILEGES ON *.* TO 'hue'@'%' IDENTIFIED BY '123' WITH GRANT OPTION;
flush privileges;
三、修改hue的配置文件$HUE_HOME/desktop/conf/hue.ini
主要修改的地方;
1、Hue的启动主机地址以及IP,设置登录的用户和组
2、Hadoop集群启动的参数,HDFS以及Yarn的启动位置
3、Mysql的地址,链接所用的用户、密码以及库名
4、HiveServer的地址
5、zookeeper集群的地址。
6、不需要启动加载的插件:appblack
1\设置标签:[desktop]
[desktop]
# Webserver listens on this address and port
http_host=10.0.0.3
http_port=8888
# Time zone name
time_zone=Asia/Shanghai
# Webserver runs as this user
server_user=hue123
server_group=hue123
# This should be the Hue admin and proxy user
default_user=hue123
# This should be the hadoop cluster admin
default_hdfs_superuser=root
2\:设置标签:[[database]]
host=10.0.0.3
port=3306
engine=mysql
user=hue123
password=***
name=hue123
3:设置:[hadoop]
[hadoop]
# Configuration for HDFS NameNode
# ------------------------------------------------------------------------
[[hdfs_clusters]]
# HA support by using HttpFs
[[[default]]]
# Enter the filesystem uri
fs_defaultfs=hdfs://master02.yscredit.com:8020
#fs_defaultfs=hdfs://ns1
# NameNode logical name.
#logical_name=ns1
# Use WebHdfs/HttpFs as the communication mechanism.
# Domain should be the NameNode or HttpFs host.
# Default port is 14000 for HttpFs.
webhdfs_url=http://master02.yscredit.com:50070/webhdfs/v1
# Change this if your HDFS cluster is Kerberos-secured
# security_enabled=true
# In secure mode (HTTPS), if SSL certificates from YARN Rest APIs
# have to be verified against certificate authority
## ssl_cert_ca_verify=True
# Directory of the Hadoop configuration
hadoop_hdfs_home=/opt/hadoop-2.6.0-cdh5.8.0
hadoop_bin=/opt/hadoop-2.6.0-cdh5.8.0/bin
## hadoop_conf_dir=$HADOOP_CONF_DIR when set or '/etc/hadoop/conf'
hadoop_conf_dir=/opt/hadoop-2.6.0-cdh5.8.0/etc/hadoop
# Configuration for YARN (MR2)
# ------------------------------------------------------------------------
[[yarn_clusters]]
[[[default]]]
# Enter the host on which you are running the ResourceManager
resourcemanager_host=master01.yscredit.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://master01.yscredit.com:8088
# URL of the ProxyServer API
proxy_api_url=http://master01.yscredit.com:8088
# URL of the HistoryServer API
history_server_api_url=http://master01.yscredit.com:19888
4、设置Hive:[beeswax]
[beeswax]
# Host where HiveServer2 is running.
# If Kerberos security is enabled, use fully-qualified domain name (FQDN).
hive_server_host=master02.yscredit.com
# Port where HiveServer2 Thrift server runs on.
hive_server_port=10000
hive_home_dir=/opt/hive-1.1.0-cdh5.8.0
# Hive configuration directory, where hive-site.xml is located
hive_conf_dir=/opt/hive-1.1.0-cdh5.8.0/conf
5\设置zookeeper:
[zookeeper]
[[clusters]]
[[[default]]]
# Zookeeper ensemble. Comma separated list of Host/Port.
# e.g. localhost:2181,localhost:2182,localhost:2183
## host_ports=localhost:2181
host_ports=zookeeper01.yscredit.com:2181,zookeeper02.yscredit.com:2181,zookeeper03.yscredit.com:2181
# The URL of the REST contrib service (required for znode browsing).
## rest_url=http://localhost:9998
# Name of Kerberos principal when using security.
## principal_name=zookeeper
[libzookeeper]
# ZooKeeper ensemble. Comma separated list of Host/Port.
# e.g. localhost:2181,localhost:2182,localhost:2183
## ensemble=localhost:2181
ensemble=zookeeper01.yscredit.com:2181,zookeeper02.yscredit.com:2181,zookeeper03.yscredit.com:2181
# Name of Kerberos principal when using security.
## principal_name=zookeeper
6、设置黑名单
# Comma separated list of apps to not load at server startup.
# e.g.: pig,zookeeper
# pig, hbase, search, indexer, sqoop, impala
app_blacklist=pig,hbase,sqoop
四、初始化Hue的mysql数据库:
先在mysql里面创建数据库hue,然后修改hue.ini
[[database]]
engine=mysql
host=slave1
port=3306
user=hadoop
password=******
name=hue
完成以上的这个配置,启动Hue,通过浏览器访问,会发生错误,原因是mysql数据库没有被初始化
DatabaseError: (1146, "Table 'hue.desktop_settings' doesn't exist")
执行以下指令对hue数据库进行初始化
cd $HUE_HOME/build/env/
bin/hue syncdb
bin/hue migrate
需要注意的是
1、在执行bin/hue syncdb时提示了
You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no):yes
Username (leave blank to use 'root'):root
Email address:
Password:
Password (again):
Superuser created successfully.
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
此时会为hue创建一个初始化的用户,即超级管理员用户,同时会在mysql的元数据库hue中的auth_user表中创建一个用户(即上面输入的用户),用于作为超级管理员登录hue
2、此外需要注意的是如果使用的是:
/build/env/bin/hue syncdb --noinput
则不会让输入初始的用户名和密码,只有在首次登录时才会让输入,作为超级管理员账户。
执行完以后,可以在mysql中看到,hue相应的表已经生成。
启动hue, 能够正常访问了
nohup /opt/hue/build/env/bin/supervisor
之后登陆hue界面会显示
原因是没有使用过hive创建表,故HDFS中没有hive用户以及其对应的元数据的存放目录,此时可以手动挡额创建该目录。
之后仍然报错:
原因:hue.ini中没有配置正确对应的hive启动位置。修改hue.ini配置文件即可,hive在hue.ini中对应的标签是:[beeswax]
此外在hue.ini中设置:
# Comma separated list of apps to not load at server startup.
# e.g.: pig,zookeeper
# pig, hbase, search, indexer, sqoop, impala
app_blacklist=pig,hbase,sqoop
可以指定在hue启动时,不加载哪些模块,此时将不会包上面两个截图的错误。如下图在hue.ini中添加上面的配置后将不会显示pig,hbase,sqoop的错误