Docker上安装部署Superset

一、Docker上安装部署Superset

二、Superset配置MySQL的数据源

一、Docker上安装部署Superset

  • Docker一定要在CentOS7上的机器进行部署,否则会出现问题
1、查看正在运行中的镜像
[root@hadoop001 ~]# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

2、查看所有已经安装的镜像
[root@hadoop001 ~]# docker images
REPOSITORY            TAG                 IMAGE ID            CREATED             SIZE
mysql                 5.7                 f965319e89de        4 days ago          448MB
amancevice/superset   0.28.1              389762d7c335        12 months ago       1.41GB

3、因为我们要使用8088端口,所以需要先检测8088端口是否被占用了:
[root@hadoop001 ~]# netstat -nlp|grep 8088

4、-d表示该容器程序后台执行,-p表示映射的端口号,--name表示为该容器指定一个名字,最后带上版本号进行启动:
[root@hadoop001 ~]# docker run -d -p 8088:8088 --name superset amancevice/superset:0.28.1
9c2b2d2eecdfe599d9887a3058fe5c3b65d4e4dae89cb8da60824f90b8900acd

5、查看该容器是否正在运行:
[root@hadoop001 ~]# docker ps
CONTAINER ID        IMAGE                        COMMAND                  CREATED             STATUS                            PORTS                               NAMES
9c2b2d2eecdf        amancevice/superset:0.28.1   "gunicorn superset:a…"   6 seconds ago       Up 4 seconds (health: starting)   8088/tcp, 0.0.0.0:32768->8890/tcp   superset

6、运行superset进入bin/bash内部:
[root@hadoop001 ~]# docker exec -it 9c2b2d2eecdf superset-init
Username [admin]: john
User first name [admin]: john
User last name [user]: john
Email [[email protected]]: 2
Password: 
Repeat for confirmation: 
Error: the two entered values do not match

7、对superset的数据库进行更新:
superset@9d9cb8fe2cce:~$ superset db upgrade
2020-05-02 13:29:44,183:ERROR:flask_appbuilder.base:'NoneType' object has no attribute 'name'
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/flask_appbuilder/base.py", line 470, in _add_permission
    self.sm.add_permissions_view(baseview.base_permissions, baseview.__class__.__name__)
  File "/usr/local/lib/python3.6/site-packages/flask_appbuilder/security/manager.py", line 923, in add_permissions_view
    if perm_view.permission.name not in base_permissions:

8、对superset进行初始化:
superset@9d9cb8fe2cce:~$ superset init
2020-05-02 13:29:57,079:ERROR:flask_appbuilder.base:'NoneType' object has no attribute 'name'
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/flask_appbuilder/base.py", line 470, in _add_permission

9、运行docker中的runserver:
superset@9d9cb8fe2cce:~$ superset runserver
2020-05-02 13:30:12,579:INFO:root:The Gunicorn 'superset runserver' command is deprecated. Please use the 'gunicorn' command instead.
Starting server with command: 
gunicorn -w 2 --timeout 60 -b  0.0.0.0:8088 --limit-request-line 0 --limit-request-field_size 0 superset:app

[2020-05-02 13:30:12 +0000] [82] [INFO] Starting gunicorn 19.8.0
[2020-05-02 13:30:12 +0000] [82] [ERROR] Connection in use: ('0.0.0.0', 8088)
[2020-05-02 13:30:12 +0000] [82] [ERROR] Retrying in 1 second.
[2020-05-02 13:30:13 +0000] [82] [ERROR] Connection in use: ('0.0.0.0', 8088)
[2020-05-02 13:30:13 +0000] [82] [ERROR] Retrying in 1 second.
[2020-05-02 13:30:14 +0000] [82] [ERROR] Connection in use: ('0.0.0.0', 8088)
[2020-05-02 13:30:14 +0000] [82] [ERROR] Retrying in 1 second.
[2020-05-02 13:30:15 +0000] [82] [ERROR] Connection in use: ('0.0.0.0', 8088)
[2020-05-02 13:30:15 +0000] [82] [ERROR] Retrying in 1 second.
[2020-05-02 13:30:16 +0000] [82] [ERROR] Connection in use: ('0.0.0.0', 8088)
[2020-05-02 13:30:16 +0000] [82] [ERROR] Retrying in 1 second.
[2020-05-02 13:30:17 +0000] [82] [ERROR] Can't connect to ('0.0.0.0', 8088)
注意:云主机是否开放8088端口一定要注意,虽然会报种种错误,咱也看不懂啊,咱也不敢问啊

Docker上安装部署Superset_第1张图片
完美无问题

二、Docker配置MySQL的数据源

1、首先需要知道Superset默认的数据源是配置在哪儿的?
Docker上安装部署Superset_第2张图片

因为我们在Linux上也部署了MySQL,docker上也部署了MySQL的镜像文件,我们先选择把数据源修改为MySQL文件;

  • 为什么docker images查询到的显示如下,原因是什么呢?
    因为我重新启动了这个进程之后
[root@hadoop002 ~]# docker images
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
[root@hadoop002 ~]# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
     Docs: https://docs.docker.com
[root@hadoop002 ~]# systemctl start docker
[root@hadoop002 ~]# docker images
REPOSITORY            TAG                 IMAGE ID            CREATED             SIZE
mysql                 5.7                 f965319e89de        4 days ago          448MB
amancevice/superset   0.28.1              389762d7c335        12 months ago       1.41GB
You have to remove (or rename) that container to be able to reuse that name.
  • 再次使用这个命令启动发现报错如下:docker run -d -p 8088:8088 --name superset amancevice/superset:0.28.1
    解决:使用docker ps -l显示(-l 是显示最新创建的容器包括所有状态)
1、查看已经启动过的进程,不管现在的状态是否停止过:
[root@hadoop002 ~]# docker ps -l
CONTAINER ID        IMAGE                        COMMAND                  CREATED             STATUS                      PORTS               NAMES
9d9cb8fe2cce        amancevice/superset:0.28.1   "gunicorn superset:a…"   About an hour ago   Exited (0) 15 minutes ago                       clever_mendeleev

2、启动这个容器:
[root@hadoop002 ~]# docker start 9d9cb8fe2cce
9d9cb8fe2cce
[root@hadoop002 ~]# netstat -nlp|grep 8088
tcp6       0      0 :::8088                 :::*                    LISTEN      2471/docker-proxy   
  • 解析:mysql://root:[email protected]/superset?charset=utf8 --> root表示访问数据库的用户名,960210访问数据库的密码,47.98.238.163表示数据库所在机器IP地址,superset表示相应要连接的数据库,?charset=utf8表示的是允许中文字符集不会出现乱码
    Docker上安装部署Superset_第3张图片
    如下文档为编辑连接的相关信息:
  • http://docs.sqlalchemy.org/en/rel_1_0/core/engines.html#database-urls

点击保存成功:
Docker上安装部署Superset_第4张图片

你可能感兴趣的:(BI展示平台)