组件 | 描述 |
---|---|
Ambari | 2.7.1 |
HDP | 3.0.1 |
Hue | 4.3.0 |
python-simplejson-3.8.2-12.1.x86_64.rpm
saslwrapper-0.16-5.el7.x86_64.rpm
saslwrapper-devel-0.16-5.el7.x86_64.rpm
git clone https://github.com/snakecy/ambari-hue-service.git
# hue编译环境
yum install -y ant asciidoc cyrus-sasl-devel cyrus-sasl-gssapi cyrus-sasl-plain gcc gcc-c++ krb5-devel libffi-devel libxml2-devel libxslt-devel make mysql mysql-devel openldap-devel python-devel sqlite-devel gmp-devel libtidy maven
yum install -y gcc openssl-devel
[root@manager241 tgm]# unzip hue-release-4.3.0.zip
[root@manager241 tgm]# mv hue-release-4.3.0 /opt/
[root@manager241 tgm]# cd /opt/
[root@manager241 opt]# mv hue-release-4.3.0 hue-4.3.0
[root@manager241 opt]# cd hue-4.3.0
[root@manager241 hue-4.3.0]# make apps
[root@manager241 opt]# touch hue-4.3.0/build/env/bin/replace_py_pwd.py
[root@manager241 opt]# cd hue-4.3.0/build/env/bin/
[root@manager241 bin]# vim replace_py_pwd.py
import os
import re
files = os.listdir('./')
def replaceStr(file):
with open(file, 'r') as f:
str = f.read()
str1 = re.sub("/opt/hue-4.3.0/build/env/bin/python2.7", "/usr/local/hue-4.3.0/build/env/bin/python2.7", str)
with open(file, 'w') as f:
f.write(str1)
for f in files:
replaceStr(f)
[root@manager241 bin]# chmod +x replace_py_pwd.py
[root@manager241 opt]# tar -zcvf hue-4.3.0.tgz hue-4.3.0/
[root@manager241 opt]# mkdir -p /var/www/html/hue
[root@manager241 opt]# cp hue-4.3.0.tgz /var/www/html/hue/
[root@manager241 opt]# cd /root/tgm/
[root@manager241 tgm]# cp python-simplejson-3.8.2-12.1.x86_64.rpm /var/www/html/hue/
[root@manager241 tgm]# cp saslwrapper-* /var/www/html/hue/
[root@manager241 tgm]# cd /var/www/html/hue/
[root@manager241 hue]# yum install createrepo -y
[root@manager241 hue]# createrepo /var/www/html/hue/
[root@manager241 hue]# cd /var/lib/ambari-server/resources/stacks/HDP/3.0/services/
[root@manager241 services]# mkdir HUE
[root@manager241 services]# cd HUE/
[root@manager241 HUE]# touch metainfo.xml
[root@manager241 HUE]# chmod +x metainfo.xml
# metainfo.xml 内容如下:
<metainfo>
<schemaVersion>2.0schemaVersion>
<services>
<service>
<name>HUEname>
<extends>common-services/HUE/4.3.0extends>
<version>4.3.0version>
<osSpecifics>
<osSpecific>
<osFamily>anyosFamily>
<packages>
<package><name>wgetname>package>
<package><name>tarname>package>
<package><name>asciidocname>package>
<package><name>krb5-develname>package>
<package><name>libxml2-develname>package>
<package><name>libxslt-develname>package>
<package><name>openldap-develname>package>
<package><name>python-develname>package>
<package><name>python-setuptoolsname>package>
<package><name>python-psycopg2name>package>
<package><name>sqlite-develname>package>
<package><name>rsyncname>package>
<package><name>saslwrapper-develname>package>
<package><name>pycryptoname>package>
<package><name>gmp-develname>package>
<package><name>libyaml-develname>package>
<package><name>cyrus-sasl-plainname>package>
<package><name>cyrus-sasl-develname>package>
<package><name>cyrus-sasl-gssapiname>package>
<package><name>libffi-develname>package>
<package><name>MySQL-clientname>package>
packages>
osSpecific>
osSpecifics>
service>
services>
metainfo>
[root@manager241 HUE]# cd /var/lib/ambari-server/resources/common-services/
[root@manager241 common-services]# mkdir HUE
[root@manager241 tgm]# cp -r ambari-hue-service/ /var/lib/ambari-server/resources/common-services/HUE/
[root@manager241 common-services]# cd HUE/
[root@manager241 HUE]# mv ambari-hue-service 4.3.0
[root@manager241 HUE]# chmod -R +x 4.3.0/
[root@manager241 ~]# ambari-server restart
[root@manager241 ~]# ambari-agent restart
Ambari页面-服务-添加服务-选中hue服务-点击下一步-配置数据库-进行部署
在部署的过程中出现各种问题,问题解决,参考后面“问题修复”
vim /var/lib/ambari-server/resources/common-services/HUE/4.3.0/package/scripts/params.py
import commands
download_url = commands.getoutput('cat /etc/yum.repo.d/hue.repo | grep "baseurl" | awk -F= \'{ print $2"hue.tgz"}\'')
[root@manager241 ~]# cd /etc/yum.repos.d/
[root@manager241 yum.repos.d]# cp centos.repo hue.repo
[root@manager241 yum.repos.d]# vim hue.repo
[hue]
name=hue
baseurl=http://10.180.210.241/hue/
gpgcheck=0
enabled=1
[root@manager241 yum.repos.d]# scp hue.repo master241.bigdata:$PWD
[root@manager241 yum.repos.d]# scp hue.repo worker241.bigdata:$PWD
# 搭建maven环境
参考:https://blog.csdn.net/Happy_Sunshine_Boy/article/details/91375219
# 安装环境
yum install -y ant asciidoc cyrus-sasl-devel cyrus-sasl-gssapi cyrus-sasl-plain gcc gcc-c++ krb5-devel libffi-devel libxml2-devel libxslt-devel make mysql mysql-devel openldap-devel python-devel sqlite-devel gmp-devel libtidy maven
vim /var/lib/ambari-server/resources/common-services/HUE/4.3.0/configuration/hue-desktop-site.xml
问题描述:
在hue操作hive的时候,获取不到hive的hiveserver2连接(hive_server_host,hive_server_port)
,手动修改配置文件/usr/local/hue/desktop/conf/pseudo-distributed.ini中有关hive的信息,重启hue时会重置配置文件,使手动配置的hiveserver2信息丢失。
解决:
vim /var/lib/ambari-agent/cache/common-services/HUE/4.3.0/package/scripts/params.py
修改为:
hive_server_hosts = default("/clusterHostInfo/hive_server_hosts", [])
hive_server_host = config['clusterHostInfo']['hive_server_hosts'][0]
解决:
vim /var/lib/ambari-server/resources/common-services/HUE/4.3.0/package/scripts/params.py
404 spark_thriftserver_hosts = default("/clusterHostInfo/spark_thriftserver_hosts", [])
405 spark_thriftserver_host = "localhost"
406 spark_hiveserver2_thrift_port = "10002"
407 spark_history_server_url = ''
408 if len(spark_thriftserver_hosts) > 0:
409 spark_thriftserver_host = spark_thriftserver_hosts[0]
410 spark_hiveserver2_thrift_port = str(config['configurations']['spark-hive-site-override']['hive.server2.thrift.port']).strip()
411 spark_jobhistoryserver_hosts = default("/clusterHostInfo/spark_jobhistoryserver_hosts", [])
412 if len(spark_jobhistoryserver_hosts) > 0:
413 spark_history_server_host = spark_jobhistoryserver_hosts[0]
414 else:
415 spark_history_server_host = "localhost"
416 spark_history_ui_port = config['configurations']['spark-defaults']['spark.history.ui.port']
417 spark_history_server_url = format("http://{spark_history_server_host}:{spark_history_ui_port}")
修改为:
403 # configurations of Spark
404 #spark_thriftserver_hosts = default("/clusterHostInfo/spark_thriftserver_hosts", [])
405 #spark_thriftserver_host = "localhost"
406 #spark_hiveserver2_thrift_port = "10002"
407 #spark_history_server_url = ''
408 #if len(spark_thriftserver_hosts) > 0:
409 # spark_thriftserver_host = spark_thriftserver_hosts[0]
410 # spark_hiveserver2_thrift_port = str(config['configurations']['spark-hive-site-override']['hive.server2.thrift.port']).strip()
411 # spark_jobhistoryserver_hosts = default("/clusterHostInfo/spark_jobhistoryserver_hosts", [])
412 # if len(spark_jobhistoryserver_hosts) > 0:
413 # spark_history_server_host = spark_jobhistoryserver_hosts[0]
414 # else:
415 # spark_history_server_host = "localhost"
416 # spark_history_ui_port = config['configurations']['spark-defaults']['spark.history.ui.port']
417 # spark_history_server_url = format("http://{spark_history_server_host}:{spark_history_ui_port}")
418 spark_thriftserver_host = default("/clusterHostInfo/spark2_thriftserver_hosts", [])[0]
419 spark_hiveserver2_thrift_port = str(config['configurations']['spark2-hive-site-override']['hive.server2.thrift.port']).strip()
420 spark_jobhistoryserver_host = default("/clusterHostInfo/spark2_jobhistoryserver_hosts", [])[0]
421 spark_history_ui_port = config['configurations']['spark2-defaults']['spark.history.ui.port']
422 spark_history_server_url = format("http://{spark_jobhistoryserver_host}:{spark_history_ui_port}")
解决:
vim /var/lib/ambari-server/resources/common-services/HUE/4.3.0/package/scripts/params.py
vim /var/lib/ambari-agent/cache/common-services/HUE/4.3.0/package/scripts/params.py
oozie_servers_hosts = default("/clusterHostInfo/oozie_server", [])
修改为:
oozie_servers_hosts = default("/clusterHostInfo/oozie_server_hosts", [])
vim /var/lib/ambari-server/resources/common-services/HUE/4.3.0/package/scripts/params.py
vim /var/lib/ambari-agent/cache/common-services/HUE/4.3.0/package/scripts/params.py
解决:
zookeeper_hosts = default("/clusterHostInfo/zookeeper_hosts", [])
修改为:
zookeeper_hosts = default("/clusterHostInfo/zookeeper_server_hosts", [])
代码参考:https://github.com/tgm2018/Hue4.3.0