superset安装完整过程

1.安装superset所需python依赖包

wtforms_json、flask_compress、celery、flask_migrate、flask_talisman、flask_caching、sqlparse、bleach、markdown、numpy、pandas、parsedatetime、pathlib2、simplejson,humanize,python-geohash,polyline,geopy,cryptography,backoff,msgpack,pyarrow,contextlib2,croniter,retry,selenium,isodate

命令参照以下格式

pip install wtforms_json

 2.安装(更新)setuptoolspip(为加速使用了国内镜像,可用可不用)

 pip install --upgrade setuptools pip -i https://repo.huaweicloud.com/repository/pypi/simple

 3.安装Supetset

 pip install apache-superset 

出现此类问题一般是Python版本问题,重新构造一个低版本一点的虚拟环境就行

 4.初始化Supetset数据库

superset db upgrade

 出现此类问题,进入到虚拟环境superset的bin目录下,新建文件vim superset_config.py ,添加内容以下

#Superset specific config
# SS 相关的配置
# 行数限制 5000 行
ROW_LIMIT = 5000
 
# 网站服务器端口 8088
SUPERSET_WEBSERVER_PORT = 8088
 
# 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 = 'LqLpdU4LfBymvLBCxnM5vcdmBjqE5eBLu7fjMQHF9BWbi8QBzD4SFXmc'
 
# 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 = 'sqlite:path/to/superset.db'
 
# 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 = ''
SECRET_KEY通过下面命令生成一个强秘钥,替换上述相应处
openssl rand -base64 42

5.superset初始化

superset init

6.创建管理员,只需要填写用户名和密码,其他回车就行

export FLASK_APP=superset
superset fab create-admin

7.安装gunicorn

pip install gunicorn

8.启动superset,这里的localhost可以替换为superset安装机器地址

gunicorn --workers 5 --timeout 120 --bind localhost:8787  "superset.app:create_app()" --daemon 

9.停止superset,并退出该环境

ps -ef | awk '/superset/ && !/awk/{print $2}' | xargs kill -9
conda deactivate

 

posted on 2024-03-27 16:52  ifiwereaboy  阅读(274)  评论(0编辑  收藏  举报