Superset实战之MySQL存储配置

2019年7月15日 0 条评论 576 次阅读 1 人点赞
  • 安装开发环境
yum install mysql-devel
  • 安装mysql python依赖
pip install mysqlclient MySQL-python

如果出现冲突使用以下方式解决

yum clean all
yum repolist
yum -y install gcc gcc-c++ kernel-devel
yum -y install python-devel libxslt-devel libffi-devel openssl-devel
  • 修改superset对mysql配置文件(一定要放置到python的根目录)
vim /root/superset/venv/bin/superset_config.py

在文件中写入以下内容:

import sys # import sys package, if not already imported
reload(sys)
sys.setdefaultencoding('utf-8')
# Superset specific config
#---------------------------------------------------------
ROW_LIMIT = 200000
SUPERSET_WORKERS = 4

SUPERSET_WEBSERVER_PORT = 8099
#---------------------------------------------------------

#---------------------------------------------------------
# Flask App Builder configuration
#---------------------------------------------------------
# Your App secret key
SECRET_KEY = '\2\1t567fgj7dtghjdhfui64@#$&77cvw424tkey\1\2\e\y\y\h'

# 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_DATABASE_URI = 'sqlite:////path/to/superset.db'
SQLALCHEMY_DATABASE_URI = 'mysql://root:123456@172.17.31.248:3306/superset'

# Flask-WTF flag for CSRF
CSRF_ENABLED = True

# Set this API key to enable Mapbox visualizations
MAPBOX_API_KEY = ''

注意修改元数据存储后, 原有数据不会被迁移, 需要重新初始化数据

  • 创建管理用户(需要先设置用户名在设置用户密码)
fabmanager create-admin --app superset
  • 更新数据库
superset db upgrade
qianmoQ

qianmoQ

这个人太懒什么东西都没留下

文章评论(0)