当前位置:   article > 正文

Docker 安装Apache Superset 并实现汉化和快速入门_superset 汉化

superset 汉化

什么是Apache Superset 

Apache Superset是一个现代化的企业级商业智能Web应用程序。Apache Superset 支持用户的各种数据类型可视化和数据分析,支持简单图饼图到复杂的地理空间图表。Apache Superset 是一个轻量级、简单化、直观化、可配置的BI 框架。

Docker 安装Apache  Superset

Docker 检索 superse

  1. [root@localhost ~]# docker search superset
  2. NAME DESCRIPTION STARS OFFICIAL AUTOMATED
  3. amancevice/superset Superset on Debian+Python3 278 [OK]
  4. apache/superset Apache Superset 238
  5. ******

Docker 下载并查看superset镜像

  1. [root@localhost ~]# docker pull apache/superset
  2. Using default tag: latest
  3. latest: Pulling from apache/superset
  4. 0e29546d541c: Pull complete
  5. 9b829c73b52b: Pull complete
  6. cb5b7ae36172: Pull complete
  7. 6494e4811622: Pull complete
  8. ******
  1. [root@localhost ~]# docker images
  2. REPOSITORY TAG IMAGE ID CREATED SIZE
  3. nginx latest 0e901e68141f 18 months ago 142MB
  4. mysql 5.7 2a0961b7de03 18 months ago 462MB
  5. apache/superset latest 3e8fac582908 23 months ago 1.69GB
  6. ******

创建superset 挂载目录:/opt/superset

[root@localhost opt]# mkdir /opt/superset

运行superset 容器

  1. [root@localhost opt]# docker run --name my_superset -d -p 8088:8088 -v /opt/superset:/home/superset apache/superset
  2. 8797809b77f275d4655d9bc80a1e7f227330a0973bf6ab7d1031be7a0e70b54d

查看正在运行容器

  1. [root@localhost opt]# docker ps
  2. CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
  3. 8797809b77f2 apache/superset "/bin/sh -c /usr/bin…" 43 seconds ago Up 42 seconds (healthy) 0.0.0.0:8088->8088/tcp my_superset
  4. ******

进入superset镜像

[root@localhost opt]# docker exec -it my_superset /bin/bash

superset 数据库初始化

  1. superset@8797809b77f2:/app$ superset db upgrade
  2. logging was configured successfully
  3. 2023-12-07 15:25:41,240:INFO:superset.utils.logging_configurator:logging was configured successfully
  4. 2023-12-07 15:25:41,259:INFO:root:Configured event logger of type <class 'superset.utils.log.DBEventLogger'>
  5. /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.
  6. warnings.warn(
  7. WARNI [alembic.env] SQLite Database support for metadata databases will be removed in a future version of Superset.
  8. INFO [alembic.runtime.migration] Context impl SQLiteImpl.
  9. ******

superset 应用初始化

  1. superset@8797809b77f2:/app$ superset init
  2. logging was configured successfully
  3. 2023-12-07 15:26:15,395:INFO:superset.utils.logging_configurator:logging was configured successfully
  4. 2023-12-07 15:26:15,411:INFO:root:Configured event logger of type <class 'superset.utils.log.DBEventLogger'>
  5. /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.
  6. warnings.warn(
  7. Syncing role definition
  8. 2023-12-07 15:26:32,491:INFO:superset.security.manager:Syncing role definition
  9. Syncing Admin perms
  10. ******

superset 设置管理员账户

  1. superset@8797809b77f2:/app$ export FLASK_APP=superset
  2. superset@8797809b77f2:/app$ flask fab create-admin
  3. Username [admin]: admin
  4. User first name [admin]: first
  5. User last name [user]: last
  6. Email [admin@fab.org]: admin@test.com
  7. Password:
  8. Repeat for confirmation:
  9. logging was configured successfully
  10. 2023-12-07 15:28:24,832:INFO:superset.utils.logging_configurator:logging was configured successfully
  11. ******

温馨提示:设置superset 管理员账户为:admin  密码:123456
加载superset 示例Demo 

  1. superset@8797809b77f2:/app$ superset load_examples
  2. logging was configured successfully
  3. 2023-12-07 15:29:03,488:INFO:superset.utils.logging_configurator:logging was configured successfully
  4. 2023-12-07 15:29:03,501:INFO:root:Configured event logger of type <class 'superset.utils.log.DBEventLogger'>
  5. /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.
  6. warnings.warn(
  7. Creating database reference for examples
  8. 2023-12-07 15:29:07,167:INFO:superset.utils.core:Creating database reference for examples
  9. Loading examples metadata and related data into examples
  10. Creating default CSS templates
  11. Loading [World Bank's Health Nutrition and Population Stats]
  12. Traceback (most recent call last):
  13. File "/usr/local/lib/python3.8/urllib/request.py", line 1354, in do_open
  14. h.request(req.get_method(), req.selector, req.data, headers,
  15. File "/usr/local/lib/python3.8/http/client.py", line 1256, in request
  16. self._send_request(method, url, body, headers, encode_chunked)
  17. ******

温馨提示:由于Paython 版本对语法支持差异,示例Demo会报错,但不会影响我们的使用。 

superset 管理平台访问

Apache Superset 汉化

核心命令:

  1. # 进入superset 镜像
  2. docker exec -it -u root my_superset /bin/bash
  3. # 替换/app/superset/config.py 配置文件
  4. sed -i "s/BABEL_DEFAULT_LOCALE = \"en/BABEL_DEFAULT_LOCALE = \"zh/g" superset/config.py
  5. # 替换/app/superset/config.py 配置文件
  6. sed -i "s/LANGUAGES = {}/# LANGUAGES = {}/g" superset/config.py
  7. #重新启动superset 镜像
  8. docker restart my_superset

superset 汉化界面

Apache 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 部署文档(含元数据库切换、汉化、镜像导出)

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/很楠不爱3/article/detail/152893?site
推荐阅读
相关标签
  

闽ICP备14008679号