1)環境準備python
Maven 3.6.1mysql
python (Anaconda 2.7.16)git
MySQL 5.7github
git 2.21sql
2)Hue源碼下載數據庫
git clone git@github.com:arwangasdaf/arwangasdaf.github.io.git app
3)編譯ide
一、到hue下執行 make appsui
此時可能會遇到到bug有:spa
- 沒法找到python.h文件
解決辦法:修改 Makefile.vars 文件
在這裏我是修改了默認的python路徑到Anaconda下的python下
- 找不到openssl
解決辦法:
brew upgrade openssl
export CPPFLAGS=-I/usr/local/opt/openssl/include
export LDFLAGS=-L/usr/local/opt/openssl/lib
- 找不到sasl.h
解決辦法:
執行
export CFLAGS="-I$(xcrun --show-sdk-path)/usr/include/sasl"
pip install python-ldap
- 找不到mysql的config
修改mysql_config的路徑
4)MySQL初始化
Hue默認以自帶的sqlite數據庫保存元數據,可是不適合開發環境,在這裏須要使用MySQL來替代默認的sqlite數據庫
- MySQL新建Hue表和Hue用戶
create database hue default character set utf8 default collate utf8_general_ci;
grant all on hue.* to 'hue'@'%' identified by 'hue';
grant all privileges on *.* to hue@localhost identified by 'hue' with grant option;
select * from information_schema.schemata;
flush privileges;
- Hue修改 pseudo-distributed.ini 文件
[[database]]
engine=mysql
host=localhost
port=3306
user=hue
password=hue
name=hue
- 數據庫遷移
在build/env下執行
bin/hue syncdb
bin/hue migrate
5)pycharm搭建Hue開發環境
- 在pycharm中打開Hue工程
- 在preference中選擇Interpreter
這個地方必定要選擇編譯出來的build/env/bin下的python環境
- Django環境變量
- Edit configuration
點擊run便可啓動
6)選擇sparkSql的Editor,修改 pseudo-distributed.ini 文件
[[[sparksql]]]
name=SparkSql
interface=hiveserver2
[spark]
# Host of the Sql Server
sql_server_host=host
# Port of the Sql Server
sql_server_port=10001
重啓Hue便可完成功能