> For the complete documentation index, see [llms.txt](https://docs.imdcinsights.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.imdcinsights.com/ying-yong-zhong-xin/shu-ju-yu-fen-xi/superset-kuai-su-ru-men.md).

# Superset快速入门

<br>

<figure><img src="https://libs.websoft9.com/Websoft9/DocsPicture/en/superset/superset-dash-websoft9.png" alt=""><figcaption></figcaption></figure>

部署 创达睿通 提供的 Superset 之后，请参考下面的步骤快速入门。

### 准备[​](https://support.websoft9.com/docs/superset#%E5%87%86%E5%A4%87) <a href="#zhun-bei" id="zhun-bei"></a>

1. 在云控制台获取您的 **服务器公网 IP 地址**
2. 在云控制台安全组中，检查 **Inbound（入）规则** 下的 **TCP:80** 和 **TCP:80** 端口是否开启
3. 在服务器中查看 Superset 的 **默认账号和密码**
4. 若想用域名访问 Superset，务必先完成\*\*域名五步设置\*\* 过程

### Superset 初始化向导[​](https://support.websoft9.com/docs/superset#superset-%E5%88%9D%E5%A7%8B%E5%8C%96%E5%90%91%E5%AF%BC) <a href="#superset-chu-shi-hua-xiang-dao" id="superset-chu-shi-hua-xiang-dao"></a>

#### 详细步骤[​](https://support.websoft9.com/docs/superset#%E8%AF%A6%E7%BB%86%E6%AD%A5%E9%AA%A4) <a href="#xiang-xi-bu-zhou" id="xiang-xi-bu-zhou"></a>

1. 使用本地电脑浏览器访问网址： *<http://域名>* 或  *<http://服务器公网> IP*, 进入登录页面&#x20;

   <figure><img src="https://libs.websoft9.com/Websoft9/DocsPicture/en/superset/superset-login-websoft9.png" alt=""><figcaption></figcaption></figure>
2. 输入账号密码，成功登录到 Superset 后台<br>

   <figure><img src="https://libs.websoft9.com/Websoft9/DocsPicture/en/superset/superset-console-websoft9.png" alt=""><figcaption></figcaption></figure>
3. 修改密码：【Superset Admin】>【Profiles】>【Reset my Password】&#x20;

   <figure><img src="https://libs.websoft9.com/Websoft9/DocsPicture/en/superset/superset-resetpw-websoft9.png" alt=""><figcaption></figcaption></figure>
4. 修改语言：通过右上角国旗图标设置你所需的语言&#x20;

   <figure><img src="https://libs.websoft9.com/Websoft9/DocsPicture/en/superset/superset-setlanguagech-websoft9.png" alt=""><figcaption></figcaption></figure>

#### 出现问题？[​](https://support.websoft9.com/docs/superset#%E5%87%BA%E7%8E%B0%E9%97%AE%E9%A2%98) <a href="#chu-xian-wen-ti" id="chu-xian-wen-ti"></a>

若碰到问题，请第一时刻联系 **技术支持**。也可以先参考下面列出的问题定位或 **FAQ** 尝试快速解决问题：

**Superset 密码正确，但仍然登录失败？**

### Superset 使用入门[​](https://support.websoft9.com/docs/superset#superset-%E4%BD%BF%E7%94%A8%E5%85%A5%E9%97%A8) <a href="#superset-shi-yong-ru-men" id="superset-shi-yong-ru-men"></a>

下面以连接 Superset 从 MySQL 数据源中获取数据进行分析作为范例：

1. 登录后，依次打开：【Data】>【Databases】&#x20;

   <figure><img src="https://libs.websoft9.com/Websoft9/DocsPicture/en/superset/superset-database-websoft9.png" alt=""><figcaption></figcaption></figure>
2. 点击右上角【数据库】，输入要连接的数据地址、端口、库名以及驱动（[参考](https://docs.sqlalchemy.org/en/13/core/engines.html)）<br>

   <figure><img src="https://libs.websoft9.com/Websoft9/DocsPicture/en/superset/superset-connect-websoft9.png" alt=""><figcaption></figcaption></figure>
3. 点击【确认】，追加的数据库显示在列表中&#x20;

   <figure><img src="https://libs.websoft9.com/Websoft9/DocsPicture/en/superset/superset-connect-websoft9.png" alt=""><figcaption></figcaption></figure>
4. 依次打开菜单栏：【Data】>【Datesets】&#x20;

   <figure><img src="https://libs.websoft9.com/Websoft9/DocsPicture/en/superset/superset-dataset-websoft9.png" alt=""><figcaption></figcaption></figure>
5. 点击追加 Datasets，依次选择库、SCHEMA、Table，点击追加&#x20;

   <figure><img src="https://libs.websoft9.com/Websoft9/DocsPicture/en/superset/superset-selecttable-websoft9.png" alt=""><figcaption></figcaption></figure>
6. 新追加的表已经显示在 Datasets 一览了&#x20;

   <figure><img src="https://libs.websoft9.com/Websoft9/DocsPicture/en/superset/superset-datalist-websoft9.png" alt=""><figcaption></figcaption></figure>

> 需要了解更多 Superset 的使用，请参考官方文档：Superset documentation

### Superset 常用操作[​](https://support.websoft9.com/docs/superset#superset-%E5%B8%B8%E7%94%A8%E6%93%8D%E4%BD%9C) <a href="#superset-chang-yong-cao-zuo" id="superset-chang-yong-cao-zuo"></a>

#### 安装数据库驱动[​](https://support.websoft9.com/docs/superset#installdriver) <a href="#installdriver" id="installdriver"></a>

Superset 支持数十种数据库，但 Superset Docker 镜像默认并没有安装数据库的驱动（连接程序）。

因此，需要用户进入到容器后手动安装，具体如下：

```
# 进入 Superset 容器，以 root 身份运行命令
sudo docker exec -it --user root superset-app bash

# 范例：安装 MySQL 驱动
pip install mysqlclient

# 范例：安装 PostgreSQL 驱动
pip install psycopg2
```

更多驱动参考官方Database dependencies

#### 连接数据库[​](https://support.websoft9.com/docs/superset#connectdb) <a href="#connectdb" id="connectdb"></a>

以 SQL Server 为例：

```
# 进入 Superset 容器，以 root 身份运行命令
sudo docker exec -it -u root superset-app bash

# 安装 MSSQL 驱动
pip install pymssql

# 在 SuperSet 中连接 SQLServer Database
#  E.g mssql+pymssql://sa:passwd123@192.168.16.1:1433/test
mssql+pymssql://username:password@server ip:port/database

```

#### 更换 Logo[​](https://support.websoft9.com/docs/superset#%E6%9B%B4%E6%8D%A2-logo) <a href="#geng-huan-logo" id="geng-huan-logo"></a>

如果打算用自己的 Logo 更换 Superset 容器中默认的 Logo，具体的步骤如下：

1. 使用 SFTP 上传你的 Logo 到服务器 /data 目录下
2. 将 Logo 更名为 superset-logo-horiz
3. 运行下面的命令，更换 Superset 官方默认 Logo

   ```
   docker cp /data/superset-logo-horiz.png superset-app:/app/superset/static/assets/images/superset-logo-horiz.png
   ```

   > superset-app 为 SuperSet 容器名称。
4. 刷新 Superset 后台页面，查看更换效果

#### 配置 SMTP[​](https://support.websoft9.com/docs/superset#%E9%85%8D%E7%BD%AE-smtp) <a href="#pei-zhi-smtp" id="pei-zhi-smtp"></a>

Superset 配置 SMTP 发邮件的步骤：

1. 在邮箱管理控制台获取 SMTP 相关参数
2. 修改Superset 配置文件，增加如下的 SMTP 配置段，设置好自己的参数。

   ```
   # smtp server configuration
   EMAIL_NOTIFICATIONS = True  # all the emails are sent using dryrun
   SMTP_HOST = 'smtp.163.com'
   SMTP_STARTTLS = True
   SMTP_SSL = True
   SMTP_USER = 'imdcinsights@163.com'
   SMTP_PORT = 465
   SMTP_PASSWORD = '#wwBJ8'
   SMTP_MAIL_FROM = 'imdcinsights@163.com'
   ```
3. 重启 Superset 容器后生效

   ```
   sudo docker restart superset-app
   ```

#### 重置密码[​](https://support.websoft9.com/docs/superset#%E9%87%8D%E7%BD%AE%E5%AF%86%E7%A0%81) <a href="#zhong-zhi-mi-ma" id="zhong-zhi-mi-ma"></a>

常用的 Superset 重置密码相关的操作主要有修改密码和找回密码两种类型：

**修改密码**[**​**](https://support.websoft9.com/docs/superset#%E4%BF%AE%E6%94%B9%E5%AF%86%E7%A0%81)

登录 Superset 后台，修改密码：【Settings】>【User】>【Info】

![Superset 修改密码](https://libs.websoft9.com/Websoft9/DocsPicture/en/superset/superset-resetpw-websoft9.png)

**找回密码**[**​**](https://support.websoft9.com/docs/superset#%E6%89%BE%E5%9B%9E%E5%AF%86%E7%A0%81)

如果用户忘记了密码，需要通过修改数据库中的数据表的方式找回：

1. 使用 **SSH**连接服务器，运行如下命令连接数据库

   ```
   docker exec -it superset_db psql -U superset
   ```
2. 在**数据库命令模式下**，运行如下的 SQL 语句后，用户 admin 的密码就被设置为`admin123`。

   ```
   update ab_user set password='pbkdf2:sha256:150000$w8vfDHis$b9c8fa353137417946766ed87cf20510da7e1e3a7b79eef37426330abef552bf' where username='admin';
   ```

### Superset 参数[​](https://support.websoft9.com/docs/superset#superset-%E5%8F%82%E6%95%B0) <a href="#superset-can-shu" id="superset-can-shu"></a>

Superset 应用中包含 Nginx, Docker, PostgreSQL, pgAdmin, Redis 等组件，可通过 **通用参数表** 查看路径、服务、端口等参数。

通过运行`docker ps`，可以查看到 Superset 运行时所有的 Container：

```
CONTAINER ID   IMAGE                           COMMAND                  CREATED              STATUS                                 PORTS                               NAMES
453f04935734   apache/superset:latest          "/usr/bin/docker-ent…"   About a minute ago   Up About a minute (healthy)            0.0.0.0:8088->8088/tcp              superset_app
5477e7693ef3   apache/superset:latest          "/usr/bin/docker-ent…"   About a minute ago   Up About a minute (healthy)            8088/tcp                            superset_worker
d6670fa1bc11   apache/superset:latest          "/usr/bin/docker-ent…"   About a minute ago   Up About a minute (healthy)            8088/tcp                            superset_worker_beat
17689f5d6ebb   postgres:10                     "docker-entrypoint.s…"   About a minute ago   Up About a minute                      0.0.0.0:5432->5432/tcp              superset_db
06bf52f4b856   redis:3.2                       "docker-entrypoint.s…"   About a minute ago   Up About a minute                      127.0.0.1:6379->6379/tcp            superset_cache
```

下面仅列出 Superset 本身的参数：

#### 路径[​](https://support.websoft9.com/docs/superset#path) <a href="#path" id="path"></a>

Superset 源码目录： */data/apps/superset*\
Superset 数据目录： */data/apps/superset/data/superset\_home*\
Superset 配置目录： */data/apps/superset/src/docker*\
Superset 配置文件： */data/apps/superset/src/docker/pythonpath\_dev/superset\_config.py*

#### 端口[​](https://support.websoft9.com/docs/superset#port) <a href="#port" id="port"></a>

无特殊端口

#### 版本[​](https://support.websoft9.com/docs/superset#%E7%89%88%E6%9C%AC) <a href="#ban-ben" id="ban-ben"></a>

```
# Superset Version
docker exec -it superset_app /bin/bash -c 'cat /app/superset-frontend/package.json |grep version'
```

#### 服务[​](https://support.websoft9.com/docs/superset#%E6%9C%8D%E5%8A%A1) <a href="#fu-wu" id="fu-wu"></a>

```
sudo docker  start | stop | restart | status superset-app
sudo docker  start | stop | restart | status superset-worker
sudo docker  start | stop | restart | status superset-worker_beat
sudo docker  start | stop | restart | status superset-db
sudo docker  start | stop | restart | status superset-cache
```

#### 命令行[​](https://support.websoft9.com/docs/superset#%E5%91%BD%E4%BB%A4%E8%A1%8C) <a href="#ming-ling-hang" id="ming-ling-hang"></a>

Superset 提供了强大的的命令行工具 `superset`

使用 **SSH** 登录到云服务器，登录到容器后即可使用 CLI

```
# 登录到 Superset 容器
docker exec -it superset-app bash

# 运行 CLI 命令
superset
```

主要参数如下：

```
Usage: superset [OPTIONS] COMMAND [ARGS]...

  This is a management script for the Superset application.

Options:
  --version  Show the flask version
  --help     Show this message and exit.

Commands:
  db                        Perform database migrations.
  export-dashboards         Export dashboards to JSON
  export-datasource-schema  Export datasource YAML schema to stdout
  export-datasources        Export datasources to YAML
  fab                       FAB flask group commands
  flower                    Runs a Celery Flower web server Celery Flower
                            is...

  import-dashboards         Import dashboards from JSON
  import-datasources        Import datasources from YAML
  init                      Inits the Superset application
  load-examples             Loads a set of Slices and Dashboards and a...
  load-test-users           Loads admin, alpha, and gamma user for testing...
  refresh-druid             Refresh druid datasources
  routes                    Show the routes for the app.
  run                       Run a development server.
  set-database-uri          Updates a database connection URI
  shell                     Run a shell in the app context.
  sync-tags                 Rebuilds special tags (owner, type, favorited...
  update-datasources-cache  Refresh sqllab datasources cache
  version                   Prints the current version number
  worker                    Starts a Superset worker for async SQL query...
```

#### API[​](https://support.websoft9.com/docs/superset#api) <a href="#api" id="api"></a>

[Superset API](https://superset.apache.org/docs/api) 采用 REST API 2.0 规范。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.imdcinsights.com/ying-yong-zhong-xin/shu-ju-yu-fen-xi/superset-kuai-su-ru-men.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
