ambari 2.7.5集成安装hue 4.6

首先感谢这两位大佬提供的方法,

Ambari集成接入Hue 4.2_源神的博客-CSDN博客_ambari 集成hue

Ambari2.7.4集成Hue4.6.0_韦晓阳的博客-CSDN博客

但是2.7.5上有些步骤稍许不一样,以下为个人本地环境验证步骤,尽量写详细。

HUE:4.6.0   下载地址:https://cdn.gethue.com/downloads/hue-4.6.0.tgz

ambari-hue-service 集成插件  下载地址:https://github.com/lijufeng2016/ambari-hue-service
 

1.hue的master节点上执行,为编译环境做准备

yum install sqlite-devel  libxslt-devel.x86_64 python-devel openldap-devel asciidoc cyrus-sasl-gssapi  libxml2-devel.x86_64 gcc gcc-c++ kernel-devel openssl-devel gmp-devel libffi-devel

 

2. 安装新版的nodejs

curl --silent --location https://rpm.nodesource.com/setup_10.x | bash -

yum install -y nodejs

3.创建用户组,所有节点

# 添加用户组

[root@node0011 ~]# groupadd hue

# 添加用户

[root@node0011 ~]# useradd  -d /home/hue  -g hue hue

创建hdfs文件目录

su hdfs

hadoop fs -mkdir /user/hue

hadoop fs -chown hue:hue /user/hue

4.提前在mysql创建好hue的库并授权

登录Mysql,06节点

mysql -u root -p

123456

create database hue character set utf8;

创建用户设置密码

CREATE USER 'hue'@'%'IDENTIFIED BY 'hue_xxx';

grant ALL PRIVILEGES ON *.* TO 'hue'@'%';

CREATE USER 'hue'@'localhost'IDENTIFIED BY 'hue_xxx';

grant ALL PRIVILEGES on *.* to hue@'localhost' identified by 'hue_xxx';

FLUSH PRIVILEGES;  

5.在ambari server节点执行

TMOUT=0

VERSION=`hdp-select status hadoop-client | sed 's/hadoop-client - \([0-9]\.[0-9]\).*/\1/'`

sudo git clone https://github.com/lijufeng2016/ambari-hue-service.git /var/lib/ambari-server/resources/stacks/HDP/$VERSION/services/HUE(我本地一直下载失败,所以手动下载后放到相应的目录)

由于已经提交下载完成,直接放入相应的文件夹即可。

需要要server目录手动创建hue文件夹,放入后需要手动解压 unzip xxxxx

 

mkdir /var/www/html/ambari/HDP/centos7/3.1.4.0-315/hue/

hue-4.6.0.tgz安装包放在hue目录下

6.修改代码和环境配置

cd /var/lib/ambari-server/resources/stacks/HDP/3.1/services/HUE/package/files

vim configs.sh

USERID="admin"

PASSWD="admin"

PORT=":8080"

params.py文件

vi /var/lib/ambari-server/resources/stacks/HDP/3.1/services/HUE/package/scripts/params.py

download_url :第五步中hue-4.6.0.tgz包的位置,

ambari_server_hostname : ambari_server的安装节点主机名

 

修改sudo.py

vim /usr/lib/ambari-agent/lib/resource_management/core/sudo.py

Ps:这步需要注意按之前文章直接加上,会导致修改的节点显示故障,如下图,这样修改会直接报节点故障

经过尝试按以下格式添加即可

 7.重启ambari

ambari-server restart

重启完过后可以看添加服务页面有Hue服务 

直接下一步

database password : 这里我填的Hue的数据库密码

mysql password : 这里我填的Hue的数据库密码

 

保持默认

 

8.Hue安装与启动成功,

9.修改配置

修改hue的pseudo-distributed.ini 配置

  allowed_hosts=*

 

修改pseudo-distributed.ini

 

修改host和port

把hiveserver2的host和端口号手动设置一下

在hue-hive-site配置下面

 

10.编译hue

在安装节点上

cd /usr/hdp/3.1.4.0-315/hue/

make apps

这里我本地验证报错

 File "/usr/hdp/3.1.4.0-315/hue/desktop/core/ext-py/MySQL-python-1.2.5/setup_posix.py", line 25, in mysql_config

    raise EnvironmentError("%s not found" % (mysql_config.path,))

EnvironmentError: mysql_config not found

通过查询怀疑是环境变量导致 的

执行以下命令解决

yum install mysql-devel

编译完成时间大概在20分钟左右

 完成进入原生页面,第一登录需要记录用户与密码

 终于进入页面成功

 

 安装遇到的问题

Process /usr/hdp/3.1.4.0-315/hue/build/env/bin/hue runcpserver exited abnormally. Restartin

重启服务后,短暂过一会Hue服务还是故障

要看后台日志 /var/log/hue/error.log

[14/Apr/2022 15:43:47 ] supervisor   ERROR    Process /usr/hdp/3.1.4.0-315/hue/build/env/bin/hue runcpserver exited abnormally. Restarting it.

[14/Apr/2022 15:43:47 ] supervisor   ERROR    Process /usr/hdp/3.1.4.0-315/hue/build/env/bin/hue kt_renewer exited abnormally. Restarting it.

[14/Apr/2022 15:43:48 ] supervisor   ERROR    Process /usr/hdp/3.1.4.0-315/hue/build/env/bin/hue kt_renewer exited abnormally. Restarting it.

[14/Apr/2022 15:43:48 ] supervisor   ERROR    Process /usr/hdp/3.1.4.0-315/hue/build/env/bin/hue runcpserver exited abnormally. Restarting it.

手动执行报错

[root@hadoop06 ~]# /usr/hdp/3.1.4.0-315/hue/build/env/bin/hue kt_renewer

    return self._coerce_type(raw_val, prefix)

  File "/usr/hdp/3.1.4.0-315/hue/desktop/core/src/desktop/lib/conf.py", line 295, in _coerce_type

    return self.type(raw)

  File "/usr/hdp/3.1.4.0-315/hue/desktop/core/src/desktop/redaction/engine.py", line 142, in parse_redaction_policy_from_file

    with open(filename) as f:

TypeError: coercing to Unicode: need string or buffer, NoneType found

解决 :

通过查看脚本发现应该是先通过return self.type(raw)获取到值,然后再调下面脚本的parse_redaction_policy_from_file 方法

排查/usr/hdp/3.1.4.0-315/hue/desktop/core/src/desktop/lib/conf.py发现

由于 参考大佬的方法 修改错了地方导致的

File "/usr/hdp/3.1.4.0-315/hue/desktop/core/src/desktop/lib/conf.py", line 295, in _coerce_type

    return self.type(raw)

这个return反馈的有问题才导致下面的filename获取不到

将之前改的改回来

if raw is Noe or raw:

django.db.utils.OperationalError: (1049, "Unknown database 'hue'")

上面问题解决了,重启error.log报错还是一至,但是重新执行脚本

/usr/hdp/3.1.4.0-315/hue/build/env/bin/hue  runcpserver

 报错如下,"Unknown database 'hue'"

 File "/usr/hdp/3.1.4.0-315/hue/build/env/lib/python2.7/site-packages/MySQL_python-1.2.5-py2.7-linux-x86_64.egg/MySQLdb/connections.py", line 193, in __init__

    super(Connection, self).__init__(*args, **kwargs2)

django.db.utils.OperationalError: (1049, "Unknown database 'hue'")

通过排查发现Mysql库里没这个Hue这个库,,!!! 好奇怪之前明明创建好的

问题解决,服务恢复正常

 

Exception Value:(1146, "Table 'hue.auth_user' doesn't exist") 

查询mysqlhue并没有生成相应的表

Error日志打印

File "/usr/hdp/3.1.4.0-315/hue/build/env/lib/python2.7/site-packages/Django-1.11.22-py2.7.egg/django/db/models/sql/query.py", line 480, in get_aggregation

    result = compiler.execute_sql(SINGLE)

  File "/usr/hdp/3.1.4.0-315/hue/build/env/lib/python2.7/site-packages/Django-1.11.22-py2.7.egg/django/db/models/sql/compiler.py", line 899, in execute_sql

raise original_exception

尝试网上方法新创建库,但是报错

 重装后还是报错, Hue库下面并不能自动生成相应 的表

最后各种尝试,最后重新编译Hue后,数据库表生成成功,hue服务正常

页面加载Hive表失败

解决方法 :《 第9步 修改配置 》,

这个报错是由于 修改配置错了导致的

 

 

 

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值