背景
最近在客户支持的时候,客户提到starrocks是否支持接入到hue,于是了解和实践了下,方便后续对接其他客户。
HUE=Hadoop User Experience Hue是一个开源的Apache Hadoop UI系统,由Cloudera Desktop演化而来,最后Cloudera公司将其贡献给Apache基金会的Hadoop社区,它是基于Python Web框架Django实现的。
通过使用Hue我们可以在浏览器端的Web控制台上与Hadoop集群进行交互来分析处理数据,例如操作HDFS上的数据,运行MapReduce Job,执行Hive的SQL语句,浏览Hbase数据库等等
详情可参考https://gethue.com/
Demo
依赖
#创建以来的db
mysql>create database hue;
mysql>grant all privileges on hue.* to 'hue' identified by '$password';
mysql>flush privileges;
部署
docker pull gethue/hue:latest
docker run -d -p 8888:8888 gethue/hue:latest
docker cp <container id>:/usr/share/hue/desktop/conf/hue.ini . #容器内没有vim,需要apt-get install安装,拷贝到自己计算机修改
配置hue依赖的数据库,如果不进行设置的话,sql执行会报错“database is locked”
[[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=mysql #引擎
host=$mysql_host #主机名
port=3306 #端口
user=hue #用户名
password=$passwd
name=hue #数据库名
配置starrocks
[[interpreters]]
\# Define the name and how to connect and execute the language.
\# https://docs.gethue.com/administrator/configuration/editor/
[[[mysql]]]
name = StarRocks
interface=sqlalchemy
#options='{"url": "mysql://$user:@$hostname:$port/$database?charset=utf8mb4"
options='{"url": "mysql://root:@$fe_host:query_port/ssb?charset=utf8mb4"}'
拷贝配置文件到容器并重启
docker cp hue.ini <container id>:/usr/share/hue/desktop/conf/
docker restart <container id>
#初始化db
docker exec -it <container id> /bin/bash
#以下操作在容器内
/usr/share/hue/build/env/bin/hue syncdb
/usr/share/hue/build/env/bin/hue migrate
可视化demo
登录web ui配置
创建用户,将作为管理员账号