依賴安裝:html
yum install -y ant gcc gcc-c++ krb5-devel mysql mysql-devel openssl-devel cyrus-sasl-gssapi cyrus-sasl sqlite-devel libacl-devel libtidy libxml2-devel libxslt-devel python-devel python-simplejson python-setuptools rsync saslwrapper gmp gmp-devel openldap-devel
make install
> 注: HDP 提供發行版的 HUE, 和開源的HUE有些不一樣, 但未添加到 Ambari 的 Service Stack 中, 須要手動安裝及配置, 安裝配置信息參考: [Command Line Installation-Chapter 15. Installing Hue](http://dev.hortonworks.com.s3.amazonaws.com/HDPDocuments/HDP2/HDP-2-trunk/bk_command-line-installation/content/installing_hue.html)
使用 github 上的 ambari-hue-service 完成, 實際操做過程參考 (Hue 3 on HDP installation tutorial)[http://gethue.com/hadoop-hue-3-on-hdp-installation-tutorial/]。java
git clone https://github.com/EsharEditor/ambari-hue-service.git /var/lib/ambari-server/resource/stack/HDP/<version>/services/HUE
增長 hue service 的前提: 在 HDP 的 repo 中添加編譯好的 hue 且路徑爲{HDP.repo}/hue/hue-3.11.0.tgz
。安裝地址爲: /usr/local/hue
。python
重啓 ambari-server , 增長 hue 。mysql
可能遇到問題:c++
UnicodeEncodeError: 'ascii' codec can't encode character u'\u201c' in position 3354: ordinal not in range(128)
做者給出的解決方案是: 爲 ambari-common 中的 sudo , py 增長編碼格式:git
import sys reload(sys) sys.setdefaultencoding('utf-8')
個人解決方案: 修改 setup.py , 增長生成 hue 配置文件時, 指定編碼格式爲 utf-8
。github
File(format("{hue_conf_dir}/pseudo-distributed.ini"), content = InlineTemplate(params.hue_pseudodistributed_content), owner = params.hue_user, # 添加 encoding = 'utf-8' )
[12/Jul/2017 21:55:26 -0700] file_reporter ERROR failed to write metrics to file Traceback (most recent call last): File "/usr/local/hue/desktop/core/src/desktop/lib/metrics/file_reporter.py", line 51, in report_now json.dump(self.registry.dump_metrics(), f) File "/usr/local/hue/desktop/core/src/desktop/lib/metrics/registry.py", line 107, in dump_metrics metrics = self._registry.dump_metrics() File "/usr/local/hue/build/env/lib/python2.6/site-packages/pyformance-0.3.2-py2.6.egg/pyformance/registry.py", line 215, in dump_metrics metrics[key] = self.get_metrics(key) File "/usr/local/hue/build/env/lib/python2.6/site-packages/pyformance-0.3.2-py2.6.egg/pyformance/registry.py", line 199, in get_metrics metrics.update(getter(key)) File "/usr/local/hue/build/env/lib/python2.6/site-packages/pyformance-0.3.2-py2.6.egg/pyformance/registry.py", line 132, in _get_gauge_metrics return {"value": gauge.get_value()} File "/usr/local/hue/build/env/lib/python2.6/site-packages/pyformance-0.3.2-py2.6.egg/pyformance/meters/gauge.py", line 36, in get_value return self.callback() File "/usr/local/hue/desktop/core/src/desktop/metrics.py", line 110, in <lambda> callback=lambda: User.objects.count(), File "/usr/local/hue/build/env/lib/python2.6/site-packages/Django-1.6.10-py2.6.egg/django/db/models/manager.py", line 136, in count return self.get_queryset().count() File "/usr/local/hue/build/env/lib/python2.6/site-packages/Django-1.6.10-py2.6.egg/django/db/models/query.py", line 294, in count return self.query.get_count(using=self.db) File "/usr/local/hue/build/env/lib/python2.6/site-packages/Django-1.6.10-py2.6.egg/django/db/models/sql/query.py", line 390, in get_count number = obj.get_aggregation(using=using)[None] File "/usr/local/hue/build/env/lib/python2.6/site-packages/Django-1.6.10-py2.6.egg/django/db/models/sql/query.py", line 356, in get_aggregation result = query.get_compiler(using).execute_sql(SINGLE) File "/usr/local/hue/build/env/lib/python2.6/site-packages/Django-1.6.10-py2.6.egg/django/db/models/sql/compiler.py", line 786, in execute_sql cursor.execute(sql, params) File "/usr/local/hue/build/env/lib/python2.6/site-packages/Django-1.6.10-py2.6.egg/django/db/backends/util.py", line 53, in execute return self.cursor.execute(sql, params) File "/usr/local/hue/build/env/lib/python2.6/site-packages/Django-1.6.10-py2.6.egg/django/db/utils.py", line 99, in __exit__ six.reraise(dj_exc_type, dj_exc_value, traceback) File "/usr/local/hue/build/env/lib/python2.6/site-packages/Django-1.6.10-py2.6.egg/django/db/backends/util.py", line 53, in execute return self.cursor.execute(sql, params) ProgrammingError: relation "auth_user" does not exist LINE 1: SELECT COUNT(*) FROM "auth_user"
參考 ambari-hue-service 的 README.md , 運行集成的 custom command 解決, 即執行 migrate。 > 其實是執行 Django 的同步數據的指令, 即 Django 的python manage.py syncdb;python manage.py migrate
web
###. 使用 hive 問題:sql
relation "beeswax_session" does not exist LINE 1: ...application", "beeswax_session"."properties" FROM "beeswax_s... ^ There are currently no rules defined. To get started, right click on any table column in the SQL Assist panel.
relation "beeswax_session" does not exist LINE 1: ...application", "beeswax_session"."properties" FROM "beeswax_s... ^ hive |-Databases |-Error loading databases.
參考:shell
在 hue.ini 中, ha 的 NameNode 和 普通狀態的 NameNode 須要配置的 webhdfs_url 不一樣:
[hadoop] [[hdfs_clusters]] [[[default]]] # Enter the filesystem uri fs_defaultfs=hdfs://localhost:8020 # Use WebHdfs/HttpFs as the communication mechanism. # Domain should be the NameNode or HttpFs host. webhdfs_url=http://localhost:50070/webhdfs/v1
須要完成的準備工做以下:
Hadoop HttpFS
yum install hadoop-httpfs
/etc/hadoop-httpfs/conf/httpfs-site.xml
中添加如下配置:<property> <name>httpfs.proxyuser.hue.hosts</name> <value>*</value> </property> <property> <name>httpfs.proxyuser.hue.groups</name> <value>*</value> </property>
啓動 HttpFS service
在 core.xml 中添加如下配置:
<property> <name>hadoop.proxyuser.httpfs.groups</name> <value>*</value> </property> <property> <name>hadoop.proxyuser.httpfs.hosts</name> <value>*</value> </property>
配置 hue.ini :
[hadoop] [[hdfs_clusters]] [[[default]]] # Enter the filesystem uri # 使用 NameNode service ID fs_defaultfs=hdfs://mycluster # Use WebHdfs/HttpFs as the communication mechanism. # Domain should be the NameNode or HttpFs host. webhdfs_url=http://localhost:14000/webhdfs/v1
重啓 hue。
問題描述:
經過 ambari 安裝 hue 後, 管理員用戶沒法登陸。
問題排查: hue 的數據庫中無管理員用戶。
解決方法:
進入hue shell 進行添加用戶。
# Django 提供的服務端的命令行, 可直接執行一些代碼 $HUE_DIR/build/env/bin/hue shell
執行如下代碼
# hue shell from django.contrib.auth.models import User user = User.objects.create(username='admin') user.set_password('admin') user.is_superuser = True user.save
# 忘記密碼時修改密碼 from django.contrib.auth.models import User user = User.objects.get(username='example') user.set_password('some password') user.save()
環境描述: 管理工具使用 ambari, Hadoop 使用 HDP2.5 發行版, hue版本爲 3.11.0。
問題描述: 經過合法的用戶登錄 hue, 進入 hive 的界面, 沒法加載 database 信息和 table 信息。
定位問題思路:
hive
命令和 beeline
可以正常鏈接到 hive 執行 sql, 排除 hive 引發問題;類似現象:
https://community.hortonworks.com/questions/48834/hivebeewax-on-hue-time-out-error-while-i-run-simpl.html
https://stackoverflow.com/questions/16247073/how-to-refresh-clear-the-distributedcache-when-using-hue-beeswax-to-run-hive-q