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便可完成功能