赞
踩
Apache Superset是一个现代化的企业级商业智能Web应用程序。Apache Superset 支持用户的各种数据类型可视化和数据分析,支持简单图饼图到复杂的地理空间图表。Apache Superset 是一个轻量级、简单化、直观化、可配置的BI 框架。
Docker 检索 superse
- [root@localhost ~]# docker search superset
- NAME DESCRIPTION STARS OFFICIAL AUTOMATED
- amancevice/superset Superset on Debian+Python3 278 [OK]
- apache/superset Apache Superset 238
- ******
Docker 下载并查看superset镜像
- [root@localhost ~]# docker pull apache/superset
- Using default tag: latest
- latest: Pulling from apache/superset
- 0e29546d541c: Pull complete
- 9b829c73b52b: Pull complete
- cb5b7ae36172: Pull complete
- 6494e4811622: Pull complete
- ******
- [root@localhost ~]# docker images
- REPOSITORY TAG IMAGE ID CREATED SIZE
- nginx latest 0e901e68141f 18 months ago 142MB
- mysql 5.7 2a0961b7de03 18 months ago 462MB
- apache/superset latest 3e8fac582908 23 months ago 1.69GB
- ******
创建superset 挂载目录:/opt/superset
[root@localhost opt]# mkdir /opt/superset
运行superset 容器
- [root@localhost opt]# docker run --name my_superset -d -p 8088:8088 -v /opt/superset:/home/superset apache/superset
- 8797809b77f275d4655d9bc80a1e7f227330a0973bf6ab7d1031be7a0e70b54d
查看正在运行容器
- [root@localhost opt]# docker ps
- CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
- 8797809b77f2 apache/superset "/bin/sh -c /usr/bin…" 43 seconds ago Up 42 seconds (healthy) 0.0.0.0:8088->8088/tcp my_superset
- ******
进入superset镜像
[root@localhost opt]# docker exec -it my_superset /bin/bash
superset 数据库初始化
- superset@8797809b77f2:/app$ superset db upgrade
- logging was configured successfully
- 2023-12-07 15:25:41,240:INFO:superset.utils.logging_configurator:logging was configured successfully
- 2023-12-07 15:25:41,259:INFO:root:Configured event logger of type <class 'superset.utils.log.DBEventLogger'>
- /usr/local/lib/python3.8/site-packages/flask_caching/__init__.py:201: UserWarning: Flask-Caching: CACHE_TYPE is set to null, caching is effectively disabled.
- warnings.warn(
- 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.
- ******
superset 应用初始化
- superset@8797809b77f2:/app$ superset init
- logging was configured successfully
- 2023-12-07 15:26:15,395:INFO:superset.utils.logging_configurator:logging was configured successfully
- 2023-12-07 15:26:15,411:INFO:root:Configured event logger of type <class 'superset.utils.log.DBEventLogger'>
- /usr/local/lib/python3.8/site-packages/flask_caching/__init__.py:201: UserWarning: Flask-Caching: CACHE_TYPE is set to null, caching is effectively disabled.
- warnings.warn(
- Syncing role definition
- 2023-12-07 15:26:32,491:INFO:superset.security.manager:Syncing role definition
- Syncing Admin perms
- ******
superset 设置管理员账户
- superset@8797809b77f2:/app$ export FLASK_APP=superset
- superset@8797809b77f2:/app$ flask fab create-admin
- Username [admin]: admin
- User first name [admin]: first
- User last name [user]: last
- Email [admin@fab.org]: admin@test.com
- Password:
- Repeat for confirmation:
- logging was configured successfully
- 2023-12-07 15:28:24,832:INFO:superset.utils.logging_configurator:logging was configured successfully
- ******
温馨提示:设置superset 管理员账户为:admin 密码:123456
加载superset 示例Demo
- superset@8797809b77f2:/app$ superset load_examples
- logging was configured successfully
- 2023-12-07 15:29:03,488:INFO:superset.utils.logging_configurator:logging was configured successfully
- 2023-12-07 15:29:03,501:INFO:root:Configured event logger of type <class 'superset.utils.log.DBEventLogger'>
- /usr/local/lib/python3.8/site-packages/flask_caching/__init__.py:201: UserWarning: Flask-Caching: CACHE_TYPE is set to null, caching is effectively disabled.
- warnings.warn(
- Creating database reference for examples
- 2023-12-07 15:29:07,167:INFO:superset.utils.core:Creating database reference for examples
- Loading examples metadata and related data into examples
- Creating default CSS templates
- Loading [World Bank's Health Nutrition and Population Stats]
- Traceback (most recent call last):
- File "/usr/local/lib/python3.8/urllib/request.py", line 1354, in do_open
- h.request(req.get_method(), req.selector, req.data, headers,
- File "/usr/local/lib/python3.8/http/client.py", line 1256, in request
- self._send_request(method, url, body, headers, encode_chunked)
- ******
温馨提示:由于Paython 版本对语法支持差异,示例Demo会报错,但不会影响我们的使用。
superset 管理平台访问
核心命令:
- # 进入superset 镜像
- docker exec -it -u root my_superset /bin/bash
- # 替换/app/superset/config.py 配置文件
- sed -i "s/BABEL_DEFAULT_LOCALE = \"en/BABEL_DEFAULT_LOCALE = \"zh/g" superset/config.py
- # 替换/app/superset/config.py 配置文件
- sed -i "s/LANGUAGES = {}/# LANGUAGES = {}/g" superset/config.py
-
- #重新启动superset 镜像
- docker restart my_superset
-
superset 汉化界面
第一步:添加Databases(数据库)
提示:本次演示添加数据库为MySQL 8
填充 MYSQL 8 数据库连接信息
最后数据库查询列表展示我新增的MYSQL 8 数据库。
第二步:添加Datasets(数据级)
填充 Dataset/数据级信息
最后数据级查询列表展示我新增的base_building数据级。
第三步:点击Datasets(数据级) ,创建Chart(图表)
默认初始化Chart (图表)编辑页面
我基于base_building/数据集创建查询building_no\building_name\building_address的图表.
第四步:查询Chart(图表),并在DashBoard(仪表盘)中显示。
查询自己创建的Chart图表
新增看板 ,选择创建的图表
最终效果展示:
参考资料:
Apache Superset 官网:https://superset.apache.org/docs/intro
Apache Superset GitHub 地址 : https://github.com/apache/superset
SuperSet 最新 Docker 部署文档(含元数据库切换、汉化、镜像导出)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。