ambari2.7.3(hdp3.1) 安裝 hue4.2java
ambari的hdp中原生不支持hue安裝,下面介紹如何經過添加service的方式使ambari支持hue安裝:mysql
官方:http://gethue.com/nginx
Hue is an open source Workbench for developing and accessing Data Apps.git
第三方service:https://github.com/EsharEditor/ambari-hue-servicegithub
VERSION=`hdp-select status hadoop-client | sed 's/hadoop-client - \([0-9]\.[0-9]\).*/\1/'`
rm -rf /var/lib/ambari-server/resources/stacks/HDP/$VERSION/services/HUE
sudo git clone https://github.com/EsharEditor/ambari-hue-service.git /var/lib/ambari-server/resources/stacks/HDP/$VERSION/services/HUEweb
第三方service中安裝的是hue3.11,改成4.2,須要以下改動:sql
# cd /var/lib/ambari-server/resources/stacks/HDP/3.1/services/HUE
# sed -i 's/3.11.0/4.2.0/g' metainfo.xml
# sed -i 's/3.11.0/4.2.0/g' README.md
# sed -i 's/3.11.0/4.2.0/g' package/scripts/params.py
# sed -i 's/3.11.0/4.2.0/g' package/scripts/setup_hue.pyshell
# vi package/scripts/params.py數據庫
--modify lineexpress
32 #download_url = 'cat /etc/yum.repos.d/HDP.repo | grep "baseurl" | awk -F \'=\' \'{print $2"hue/hue-4.2.0.tgz"}\''
33 download_url = 'echo "http://gethue.com/downloads/releases/4.2.0/hue-4.2.0.tgz"'187 webhdfs_url = format('http://' + hdfs_httpfs_host + ':50070/webhdfs/v1')
--without yarn
:234,256s/^/#/g
# vi package/scripts/common.py
--add line 59,63,64
58 Execute('tar -zxvf hue.tgz -C {0} && rm -f hue.tgz'.format(params.hue_install_ dir))
59 Execute('mkdir -p {0}'.format(params.hue_dir))
60 # Ensure all Hue files owned by hue 61 Execute('chown -R {0}:{1} {2}'.format(params.hue_user,params.hue_group,params. hue_dir))
62 Execute('ln -s {0} /usr/hdp/current/hue-server'.format(params.hue_dir))
63 Execute('rm -rf {0}/*'.format(params.hue_dir))
64 Execute('cd /usr/local/hue-4.2.0 && make install')--comment line
90 #services_configurations['httpfs-site'] = {}
91 #services_configurations['httpfs-site']['httpfs.proxyuser.hue.groups'] = '*'
92 #services_configurations['httpfs-site']['httpfs.proxyuser.hue.hosts'] = '*'
# vi package/scripts/setup_hue.py
--comment line
26 #Logger.info("Creating symlinks /usr/hdp/current/hadoop-client/lib/hue-plugins -4.2.0-SNAPSHOT.jar")
27 #Link("{0}/desktop/libs/hadoop/java-lib/*".format(params.hue_dir),to = "/usr/h dp/current/hadoop-client/lib")
# vi package/files/configs.sh
39 PASSWD="admin"
注意這一步
download_url = 'echo "http://gethue.com/downloads/releases/4.2.0/hue-4.2.0.tgz"'
hue-4.2.0.tgz須要手工下載並放到一個服務器可訪問的url上(好比本地的nginx),同時修改這裏的download_url
useradd hue
安裝後的hue目錄位於/usr/local/hue/
1)修改數據庫配置
# vi desktop/conf/hue.ini
[[database]]
# Database engine is typically one of:
# postgresql_psycopg2, mysql, sqlite3 or oracle.
#
# Note that for sqlite3, 'name', below is a path to the filename. For other backends, it is the database name
# Note for Oracle, options={"threaded":true} must be set in order to avoid crashes.
# Note for Oracle, you can use the Oracle Service Name by setting "host=" and "port=" and then "name=<host>:<port>/<service_name>".
# Note for MariaDB use the 'mysql' engine.
## engine=sqlite3
## host=
## port=
## user=
## password=
# conn_max_age option to make database connection persistent value in seconds
# https://docs.djangoproject.com/en/1.9/ref/databases/#persistent-connections
## conn_max_age=0
# Execute this script to produce the database password. This will be used when 'password' is not set.
## password_script=/path/script
## name=desktop/desktop.db
修改engine、host、port、user、password、name
2)初始化數據庫
# build/env/bin/hue syncdb
其中會建立初試用戶名和密碼
# build/env/bin/hue migrate
3)若是要支持數據庫查詢好比mysql,找到
[[databases]]
# mysql, oracle, or postgresql configuration.
## [[[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=localhost
# 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=example
# Password matching the username to authenticate with when
# connecting to the database.
## password=example
按照註釋添加便可,可添加多個
4)若是須要增長impala查詢,找到
[impala]
# Host of the Impala Server (one of the Impalad)
# server_host=localhost
# Port of the Impala Server
## server_port=21050
注意這裏是21050端口,不是impala-shell鏈接的21000端口
5)能夠經過配置blacklist來隱藏一些組件的菜單
[desktop]
app_blacklist=beeswax,impala,security,filebrowser,jobbrowser,rdbms,jobsub,pig,hbase,sqoop,zookeeper,metastore,spark,oozie,indexer
直接啓動
# build/env/bin/hue runcherrypyserver
後臺啓動supervisor(supervisor會監控並啓動hue server)
# nohup build/env/bin/supervisor start >> logs/hue.out 2>&1 &
日誌位於 /usr/local/hue/logs/ 下
若是hue使用nginx代理,必定要設置Host,不然會報400錯誤:
location / {
proxy_pass http://hue_backend;
proxy_set_header Host hue.anything;
}
另外還能夠使用nginx來管理hue的靜態文件,加速訪問;
參考:https://blog.csdn.net/zhouyuanlinli/article/details/83374416