Superset docker、ubuntu、windows安装方式

一、Superset介绍

Superset 是一个现代化的数据探索和数据可视化平台。Superset 可以替代或增强许多团队的专有商业智能工具。Superset 与各种数据源良好集成。

二、使用背景及优缺点

公司想要使用BI,所以内部寻找合适的BI工具。

优点:免费(开源的软件)、功能齐全

缺点:样式不符合国内(领导)审美,二开困难(尝试过二开,自己引入的echart图标很难跟系统自带的联动功能关联上)

三、安装方式及推荐

3.1、docker安装(推荐)

bash 复制代码
###下载
docker pull apache/superset
docker run --name superset -d -p 8088:8088 apache/superset
docker cp /opt/superset/superset_config.py superset:/app 复制配置文件
docker cp /opt/superset/config.py superset:/app/superset
docker exec -it superset /bin/bash 进入docker容器
export SUPERSET_CONFIG_PATH=/app/superset_config.py
export FLASK_APP=superset
###初始化
superset db upgrade
superset init
flask fab create-admin
superset load_examples
plain 复制代码
# Superset specific config
# SS 相关的配置
# 行数限制 5000 行
ROW_LIMIT = 5000

#开发端口跟地址
SUPERSET_WEBSERVER_PORT = 8088
SUPERSET_WEBSERVER_HOST = "0.0.0.0"

# Flask App Builder configuration
# Your App secret key will be used for securely signing the session cookie
# and encrypting sensitive information on the database
# Make sure you are changing this key for your deployment with a strong key.
# You can generate a strong key using `openssl rand -base64 42`
# Flask 应用构建器配置
# 应用密钥用来保护会话 cookie 的安全签名
# 并且用来加密数据库中的敏感信息
# 请确保在你的部署环境选择一个强密钥
# 可以使用命令 openssl rand -base64 42 来生成一个强密钥

SECRET_KEY = "kJjHcZkBSQY0dp5kJF7Ch2kHRKAd0WymLF7aMHCFAlUE+32rW+CG0QUs"

# The SQLAlchemy connection string to your database backend
# This connection defines the path to the database that stores your
# superset metadata (slices, connections, tables, dashboards, ...).
# Note that the connection information to connect to the datasources
# you want to explore are managed directly in the web UI
# SQLAlchemy 数据库连接信息
# 这个连接信息定义了 SS 元数据库的路径(切片、连接、表、数据面板等等)
# 注意:需要探索的数据源连接及数据库连接直接通过网页界面进行管理
# SQLALCHEMY_DATABASE_URI = 'mysql://root:root@localhost/superset'

# Flask-WTF flag for CSRF
# 跨域请求攻击标识
WTF_CSRF_ENABLED = True

# Add endpoints that need to be exempt from CSRF protection
# CSRF 白名单
WTF_CSRF_EXEMPT_LIST = []

# A CSRF token that expires in 1 year
# CSFR 令牌过期时间 1 年
WTF_CSRF_TIME_LIMIT = 60 * 60 * 24 * 365

# Set this API key to enable Mapbox visualizations
# 接口密钥用来启用 Mapbox 可视化
MAPBOX_API_KEY = ''

# 汉化
BABEL_DEFAULT_LOCALE = "zh"
LANGUAGES = {
    "zh": {"flag": "cn", "name": "简体中文"},
    "en": {"flag": "us", "name": "English"},
}

# 关闭 CSRF 和 Talisman 保护
WTF_CSRF_ENABLED = False
TALISMAN_ENABLED = False
bash 复制代码
跨域并且免密登录
PUBLIC_ROLE_LIKE: str | None = "GAMMA"
PUBLIC_ROLE_LIKE_GAMMA = True
WTF_CSRF_ENABLED = False

3.2、ubuntu安装

plain 复制代码
superset-4.0.2 python3.9 node18.20.5
sudo apt-get install build-essential libssl-dev libffi-dev python3-dev python3-pip libsasl2-dev libldap2-dev default-libmysqlclient-dev
sudo apt-get install python3.9-dev



superset run -p 8088 --with-threads --reload --debugger --debug
npm run dev-server
默认localhost:9000
plain 复制代码
.bashrc文件末尾添加
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

export FLASK_APP="superset"

export SUPERSET_CONFIG_PATH="/home/xzj/superset-4.0.2/superset_config.py"

3.3、Windows安装

plain 复制代码
安装版本superset-4.0.2
环境要求python3.9、visual studio安装c++工具包(安装完成需要重启电脑生效)、nodejs:18.20.4
注意事项:要确定电脑只有python3.9一个版本

ladp包下载链接
https://github.com/cgohlke/python-ldap-build/releases/download/v3.4.3/python_ldap-3.4.3-cp39-cp39-win_amd64.whl
下载完成放到根目录(superset-4.0.2目录下) 

后端安装
在跟目录下创建python虚拟环境,并下载依赖
1、pip install virtualenv
2、virtualenv venv(可以在pycharm里面配置)
3、pip install --upgrade pip(更新pip)
4、pip install --upgrade setuptools(更新setuptools)
5、pip install "python_ldap-3.4.3-cp39-cp39-win_amd64.whl"(前面下载的ldap包)
6、pip install -r requirements/development.txt
7、pip install -e . --config-settings editable_mode=compat
8、配置SUPERSET_CONFIG_PATH="文件存放的路径"、FLASK_APP=superset(系统环境变量配置)

前端安装
1、npm install --registry=https://registry.npmmirror.com(失败重复这个命令)
2、npm run build

项目启动
superset db upgrade
superset fab create-admin
superset init
superset load-examples

superset run -p 8088 --with-threads --reload --debugger --debug(后端运行)
npm run dev-server(前端运行)
localhost:9000(这个是开发环境)

四、总结

根据最近的使用情况来说,docker部署,直接当作BI工具使用是最方便的。如果要进行二开或其它定制化,不推荐使用Superset。

相关推荐
古月-一个C++方向的小白32 分钟前
Linux初始——基础指令篇
linux·运维·服务器
古月-一个C++方向的小白39 分钟前
初始Linux——指令与权限
linux·运维·服务器
柳鲲鹏2 小时前
未成功:使用 Nginx 搭建代理服务器(正向代理 HTTPS 网站)
运维·nginx
wuyang-ligerj2 小时前
路由基础(二):路由表和FIB表
运维·网络·网络协议·智能路由器
拾心213 小时前
【运维进阶】高可用和负载均衡技术
运维·负载均衡
hyy27952276844 小时前
自动化运维之k8s——Kubernetes集群部署、pod、service微服务、kubernetes网络通信
运维·kubernetes·自动化
wuyang-ligerj4 小时前
OSPF协议(三)
运维·网络·网络协议·智能路由器
一川月白7094 小时前
Linux--->网络编程(TCP并发服务器构建:[ 多进程、多线程、select ])
linux·运维·服务器·网络编程·io并发服务器
EnigmaCoder4 小时前
【Linux】用户与用户组管理
linux·运维·服务器·数据库