1. 程式人生 > 其它 >Apache hue && StarRocks

Apache hue && StarRocks

背景

本文主要展示apache hue和starrocks結合

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配置

建立使用者,將作為管理員賬號

1178×1190 52.3 KB 2540×1220 260 KB

總有人要贏得,為什麼不能是我?