Ubuntu安装 Superset

【转载地址】:https://www.jiangzhuolin.com/5011.html

1、安装简介

Superset 是 airbnb 开源的一款轻量级的 BI 可视化工具,现已托管在 apache 基金会旗下。本文将在 Ubuntu 18.04 上安装 Superset 并简单体验。

2、安装环境

Ubuntu 18.04.5
Python 3.6.9
Superset 0.37.1

安装步骤

1、创建一个 Python 虚拟环境并激活

$ python3 -m venv venv

示例:

$ pwd       
/home/jiangzl/Workspace/superset
$ python3 -m venv venv
$ source venv/bin/activate

注:

(1) 这种创建虚拟环境的方式仅适用于 Python 3.3 及以上环境,如果是其他版本,建议使用 virtualenv 进行创建,具体方式可自行搜索。

(2) 激活虚拟环境后,使用 pip 安装的所有库只会对该环境有效,能起到环境隔离的作用。

(3) 可以使用 deactivate 退出虚拟环境

2、安装 apache superset

在第一步激活 Python3 虚拟环境条件下,执行如下命令即可安装 superset

pip3 install apache-superset

示例:

(venv) $ pip install apache-superset -i https://pypi.douban.com/simple
...

注:国内用户建议添加 -i 参数指定安装库的源地址 (index-url),加速安装。

3、初始化数据库

superset db upgrade

示例:

(venv) $ superset db upgrade
logging was configured successfully
INFO:superset.utils.logging_configurator:logging was configured successfully
/home/jiangzl/Workspace/superset-test/venv/lib/python3.6/site-packages/flask_caching/__init__.py:192: UserWarning: Flask-Caching: CACHE_TYPE is set to null, caching is effectively disabled.
  "Flask-Caching: CACHE_TYPE is set to null, "
No PIL installation found
INFO:superset.utils.screenshots:No PIL installation found
WARNI [alembic.env] SQLite Database support for metadata databases will be removed in a future version of Superset.
INFO  [alembic.runtime.migration] Context impl SQLiteImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.

4、创建 admin 角色用户

$ export FLASK_APP=superset
$ superset fab create-admin

示例:

(venv) $ export FLASK_APP=superset
(venv) $ superset fab create-admin
logging was configured successfully
INFO:superset.utils.logging_configurator:logging was configured successfully
/home/jiangzl/Workspace/superset-test/venv/lib/python3.6/site-packages/flask_caching/__init__.py:192: UserWarning: Flask-Caching: CACHE_TYPE is set to null, caching is effectively disabled.
  "Flask-Caching: CACHE_TYPE is set to null, "
No PIL installation found
INFO:superset.utils.screenshots:No PIL installation found
Username [admin]: 
User first name [admin]: 
User last name [user]: 
Email [admin@fab.org]: 
Password: 
Repeat for confirmation: 

创建 admin 用户会让你输入用户相关信息: Username(默认 admin),User first name(默认 admin),User last name(默认 user),Email(默认 admin@fab.org),这些都可以使用默认直接回车(Enter)即可。Password 请自行设置并记住。

5、导入示例数据

$ superset load_examples

注:如果是在国内,某些区域的 raw.githubusercontent.com 域名 DNS 解析被污染,如果访问不了,请在 /etc/hosts 中添加如下解析

151.101.108.133 raw.githubusercontent.com

这里需要花费比较多时间,因为连接国外服务器较慢。

(venv) $ superset load_examples
logging was configured successfully
INFO:superset.utils.logging_configurator:logging was configured successfully
/home/jiangzl/Workspace/superset/venv/lib/python3.6/site-packages/flask_caching/__init__.py:192: UserWarning: Flask-Caching: CACHE_TYPE is set to null, caching is effectively disabled.
  "Flask-Caching: CACHE_TYPE is set to null, "
No PIL installation found
INFO:superset.utils.screenshots:No PIL installation found
Loading examples metadata and related data into examples
Creating default CSS templates
Loading energy related dataset
Creating table [wb_health_population] reference
Loading [World Bank's Health Nutrition and Population Stats]
Creating table [wb_health_population] reference
Creating slices
Creating a World's Health Bank dashboard
Loading [Birth names]
Done loading table!
--------------------------------------------------------------------------------
Creating table [birth_names] reference
Creating some slices
Creating a dashboard
Loading [Unicode test data]
Done loading table!
--------------------------------------------------------------------------------
...
Creating Scatterplot slice
Creating Screen Grid slice
Creating Hex slice
Creating Grid slice
Creating Polygon slice
Creating Arc slice
Creating Path slice
Creating a dashboard
Loading [Tabbed dashboard]
Creating a dashboard with nested tabs

6、创建角色及权限

执行如下命令 superset init 即可初始化 superset 默认的角色及权限相关的数据并将其写入 SQLite 数据库中。

$ superset init

示例:

(venv) $ superset init
logging was configured successfully
INFO:superset.utils.logging_configurator:logging was configured successfully
/home/jiangzl/Workspace/superset/venv/lib/python3.6/site-packages/flask_caching/__init__.py:192: UserWarning: Flask-Caching: CACHE_TYPE is set to null, caching is effectively disabled.
  "Flask-Caching: CACHE_TYPE is set to null, "
No PIL installation found
INFO:superset.utils.screenshots:No PIL installation found
Syncing role definition
INFO:superset.security.manager:Syncing role definition
Syncing Admin perms
INFO:superset.security.manager:Syncing Admin perms
Syncing Alpha perms
INFO:superset.security.manager:Syncing Alpha perms
Syncing Gamma perms
INFO:superset.security.manager:Syncing Gamma perms
Syncing granter perms
INFO:superset.security.manager:Syncing granter perms
Syncing sql_lab perms
INFO:superset.security.manager:Syncing sql_lab perms
Fetching a set of all perms to lookup which ones are missing
INFO:superset.security.manager:Fetching a set of all perms to lookup which ones are missing
Creating missing datasource permissions.
INFO:superset.security.manager:Creating missing datasource permissions.
Creating missing database permissions.
INFO:superset.security.manager:Creating missing database permissions.
Creating missing metrics permissions
INFO:superset.security.manager:Creating missing metrics permissions
Cleaning faulty perms
INFO:superset.security.manager:Cleaning faulty perms

运行验证

1、superset 运行

$ superset run -p 8088 --with-threads --reload --debugger

示例:

$ nohup superset run -h 0.0.0.0 -p 8088 --with-threads --reload --debugger > superset.log 2>&1 &

2、访问验证

访问 http://ip:port 输入上面创建的 admin 用户进行访问

示例:

安装成功。

附录

参考:

1、superset official doc

https://superset.incubator.apache.org/docs/intro

2、installing from scratch

https://superset.incubator.apache.org/docs/installation/installing-superset-from-scratch

		<div class="wbp-cbm" wb-share-url="https://www.jiangzhuolin.com/?p=5011"><div class="dwqr-inner"><a class="wb-btn-dwqr wb-btn-donate j-dwqr-donate-btn" rel="nofollow"><svg class="wb-icon wbsico-donate"><use xlink:href="#wbsico-dwqr-donate"></use></svg><span>打赏</span></a><a class="wb-btn-dwqr wb-btn-like j-dwqr-like-btn" data-count="0" rel="nofollow"><svg class="wb-icon wbsico-like"><use xlink:href="#wbsico-dwqr-like"></use></svg><span class="like-count">赞</span></a><a class="wb-btn-dwqr wb-btn-share j-dwqr-social-btn" rel="nofollow"><svg class="wb-icon wbsico-share"><use xlink:href="#wbsico-dwqr-share"></use></svg><span>分享</span></a></div></div>          <nav class="pagination group">
                  </nav>
    </div>

    
    <div class="clear"></div>
  </div>

</div>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值