Superset 部署

前言

  • Apache Superset 是一个开源的、现代的、轻量级 BI 分析工具,能够对接多种数据源、
    拥有丰富的图标展示形式、支持自定义仪表盘,且拥有友好的用户界面,十分易用。
  • 由于 Superset 能够对接常用的大数据分析工具,如 Hive、Kylin、Druid 等,且支持自定
    义仪表盘,故可作为数仓的可视化工具。
  • 上一篇中总结了grafana的部署,同样作为可视化应用,本篇来部署下superset。

部署

注意:使用root用户操作

1.安装Python3环境准备的包

yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

2.安装Python3环境

#进⼊入源码⽂件夹
cd /usr/local/src 
#下载python文件
wget http://www.python.org/ftp/python/3.6.6/Python-3.6.6.tgz 
#解压缩
tar -xf Python-3.6.6.tgz 
#进⼊入python 文件夹
cd Python-3.6.6
#配置 
./configure 
#安装
make && make install 

3.安装EPEL源并安装superset必备的包

#安装epel源
yum install epel-release 
#安装MySQL开发包,属于pymysqlclient依赖
yum install mysql-devel 
#安装依赖包
yum install gcc gcc-c++ libffi-devel python-devel python-wheel openssl-devel libsasl2-devel openldap-devel 

4.安装python3的virtualenv并建立superset的env

# 安装virtualenv
pip3 install virtualenv -i http://pypi.douban.com/simple --trusted-host pypi.douban.com 
cd /usr/local/src/Python-3.6.6
# 建立superset的venv
./python -m venv superset-py3 
#激活superset的venv
source superset-py3/bin/activate 
#也就是启动了venv,变为了:(superset-py3) [root@node2 Python-3.6.6]#

5.在env中安装superset

#升级pip
pip3 install --upgrade pip -i http://pypi.douban.com/simple --trusted-host pypi.douban.com 
#升级setuptools
pip3 install --upgrade setuptools -i http://pypi.douban.com/simple --trusted-host pypi.douban.com 
#安装superset
pip3 install superset==0.28.1 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com 

6.安装superset数据库包

#安装mysql连接包
pip3 install mysqlclient==2.0.1 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com 
#安装mssql连接包
pip3 install "pymssql<3.0" -i http://pypi.douban.com/simple --trusted-host pypi.douban.com 

7.配置superset

# 编辑配置文件
vi superset-py3/lib/python3.6/site-packages/superset/config.py

修改superset配置⽂文件,将默认的sqlite3数据库改为MySQL: 如下修改
# SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(DATA_DIR, 'superset.db')
SQLALCHEMY_DATABASE_URI = 'mysql://root:123456Gh!@node2/superset?charset=utf8'
# SQLALCHEMY_DATABASE_URI = 'postgresql://root:password@localhost/myapp'

对应修改:
SQLALCHEMY_DATABASE_URI = 'mysql://username:password@hostname/supersetDBname?charset=utf8'

8.mysql创建superset数据库

# 另开一个终端,进入mysql
CREATE DATABASE `superset` /*!40100 DEFAULT CHARACTER SET utf8 */;

9.安装低版本pandas & SQLAlchemy

pip3 install pandas==0.23.4 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip install SQLAlchemy==1.2.18 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

10.初始化

#建⽴立管理理员账号 gaohan,密码 123456
(superset-py3) [root@ruozedata001 Python-3.6.6]# fabmanager create-admin --app superset
fabmanager is going to be deprecated in 2.2.X, you can use the same commands on th
e improved 'flask fab <command>'
Username [admin]: gaohan
User first name [admin]: gaohan
User last name [user]: gaohan
Email [admin@fab.org]:
Password: 123456
Repeat for confirmation: 123456
Recognized Database Authentications.
Admin User jepson created.

#db升级
(superset-py3) [root@ruozedata001 Python-3.6.6]# ./superset-py3/lib/python3.6/site-packages/superset/bin/superset db upgrade

INFO [alembic.runtime.migration] Context impl MySQLImpl.
INFO [alembic.runtime.migration] Will assume transactional DDL.
INFO [alembic.runtime.migration] Running upgrade bddc498dd179 -> 4451805bbaa1, re
move double percents
INFO [alembic.runtime.migration] Running upgrade 4451805bbaa1, 1d9e835a84f9 -> 70
5732c70154, empty message
INFO [alembic.runtime.migration] Running upgrade 4451805bbaa1, 1d9e835a84f9 -> fc
480c87706c, empty message
INFO [alembic.runtime.migration] Running upgrade fc480c87706c -> bebcf3fed1fe, Mi
grate dashboard position_json data from V1 to V2
INFO [alembic.runtime.migration] Running upgrade bebcf3fed1fe, 705732c70154 -> ec
1f88a35cc6, empty message
INFO [alembic.runtime.migration] Running upgrade 4451805bbaa1, 1d9e835a84f9 -> e3
970889f38e, empty message
INFO [alembic.runtime.migration] Running upgrade 705732c70154, e3970889f38e -> 46
ba6aaaac97, empty message
INFO [alembic.runtime.migration] Running upgrade 46ba6aaaac97, ec1f88a35cc6 -> c1
8bd4186f15, empty message
INFO [alembic.runtime.migration] Running upgrade c18bd4186f15 -> 7fcdcde0761c, Re
duce position_json size by remove extra space and component id prefix
INFO [alembic.runtime.migration] Running upgrade 7fcdcde0761c -> 0c5070e96b57, ad
d user attributes table
INFO [alembic.runtime.migration] Running upgrade 0c5070e96b57 -> 1a1d627ebd8e, po
sition_json
INFO [alembic.runtime.migration] Running upgrade 1a1d627ebd8e -> 55e910a74826, ad
d_metadata_column_to_annotation_model.py

#初始化superset数据库
(superset-py3) [root@ruozedata001 Python-3.6.6]# ./superset-py3/lib/python3.6/site-packages/superset/bin/superset init

2020-12-23 02:12:52,508:INFO:root:Creating database reference
2020-12-23 02:12:52,542:INFO:root:Syncing role definition
2020-12-23 02:12:52,561:INFO:root:Syncing Admin perms
2020-12-23 02:12:52,633:INFO:root:Syncing Alpha perms
2020-12-23 02:12:52,945:INFO:root:Syncing Gamma perms
2020-12-23 02:12:53,253:INFO:root:Syncing granter perms
2020-12-23 02:12:53,516:INFO:root:Syncing sql_lab perms
2020-12-23 02:12:53,810:INFO:root:Fetching a set of all perms to lookup which ones
are missing
2020-12-23 02:12:53,874:INFO:root:Creating missing datasource permissions.
2020-12-23 02:12:53,878:INFO:root:Creating missing database permissions.
2020-12-23 02:12:53,888:INFO:root:Creating missing metrics permissions
2020-12-23 02:12:53,891:INFO:root:Cleaning faulty perms
(superset-py3) [root@ruozedata001 Python-3.6.6]#

# mysql终端修改表
mysql:
alter table superset.table_columns modify type varchar(255);

11.后台启动

# 后台启动,不挂起,标准输出和错误输出至/dev/null抛弃
nohup /usr/local/src/Python-3.6.6/superset-py3/lib/python3.6/site-packages/superset/bin/superset run -h node2 -p 8889 > /dev/null 2>&1 &

12.WebUI

http://ip:8889

在这里插入图片描述

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值