基于docker安装superset

安装前准备

安装docker

  • 检查是否已安装docker(docker version)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
root@VM-32-248-ubuntu:~# docker version
Client:
Version: 1.13.1
API version: 1.26
Go version: go1.6.2
Git commit: 092cba3
Built: Thu Nov 2 20:40:23 2017
OS/Arch: linux/amd64

Server:
Version: 1.13.1
API version: 1.26 (minimum version 1.12)
Go version: go1.6.2
Git commit: 092cba3
Built: Thu Nov 2 20:40:23 2017
OS/Arch: linux/amd64
Experimental: false

选择superset镜像

  • 查找superset相关的镜像(docker search superset)
  • 选择STARS最高的amancevice/superset
  • 拉取镜像(docker pull amancevice/superset)
  • 查看镜像是否下载完成(docker images)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
root@VM-32-248-ubuntu:~# docker search superset
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
amancevice/superset [0.22.1] Superset on Debian+Python3 102 [OK]
tylerfowler/superset An extendable Docker image for Airbnb's Su... 2
crobox/superset Superset + Clickhouse docker image 2 [OK]
dailyhotel/superset Dockerized Superset 1 [OK]
tyyzqmf/superset 根据amancevice/superset修改的镜像 主要解决superset联hi... 1 [OK]
sergekatzmann/superset-oracle Docker container for Superset (Caravel) wi... 1
huksley/superset AirBnB Superset with MySQL driver 0 [OK]
maedamikio/superset 0
muicoder/superset Superset is a data exploration platform de... 0 [OK]
zmhassan/openshift-superset 0
peertopark/superset Peer to Park Superset 0
tddv/superset Superset is come from airbub superset open... 0 [OK]
ganshanshan/superset_tddv tddv superset 0 [OK]
ssskip/docker-superset airbnb superset python27 docker image 0 [OK]
ganshanshan/superset1 superset1 0 [OK]
mav1/superset_docker docker for superset 0 [OK]
cnero/superset 0
xjw263/superset-dev superset dev. https://github.com/airbnb/su... 0 [OK]
divvit/divvit-superset Our build of superset 0
pocketmedia/superset superset 0
gauseng/superset 0
treexor/superset 0
mnagaku/superset Docker image for Apache Superset (incubati... 0 [OK]
xjw263/superset-base superset-base 0 [OK]
harisekhon/superset Superset open source analytics UI by AirBNB 0 [OK]

root@VM-32-248-ubuntu:~# docker pull amancevice/superset
Using default tag: latest
latest: Pulling from amancevice/superset
723254a2c089: Pull complete
51c68011c837: Pull complete
deb347b7ea13: Pull complete
Digest: sha256:788afae818d3baef76b351acc795f17174b5581318ff6f25aa7c574442ac4355
Status: Downloaded newer image for amancevice/superset:latest

root@VM-32-248-ubuntu:~# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
amancevice/superset latest c1ca7588abda 3 weeks ago 1.57 GB

安装superset容器

  • 创建本地目录(让容器中的superset挂载本地机的配置文件)
  • 创建superset容器(docker run -d -p 8088:8088 -v /opt/docker/superset:/home/superset amancevice/superset)
  • 查看容器是否运行成功(docker ps)
1
2
3
4
5
6
7
8
root@VM-32-248-ubuntu:/# mkdir /opt/docker/superset/ -p

root@VM-32-248-ubuntu:~# docker run -d -p 8088:8088 -v /opt/docker/superset:/home/superset amancevice/superset
a01f392582bb264d227b04ef453c221585e75b6e9a605b568c8b0852b6c93a3f(容器ID)

root@VM-32-248-ubuntu:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a01f392582bb amancevice/superset "superset runserver" 2 minutes ago Up 2 minutes (healthy) 0.0.0.0:8088->8088/tcp condescending_curran

配置superset容器

  • 设置用户名和密码(docker exec -it 容器ID fabmanager create-admin –app superset)
  • 初始化数据库(docker exec -it 容器ID superset db upgrade)
  • superset初始化(docker exec -it 容器ID superset init)
  • 开启superset服务(docker exec -it 容器ID superset runserver)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
root@VM-32-248-ubuntu:~# docker exec -it a01f392582bb fabmanager create-admin --app superset
Username [admin]: makai
User first name [admin]: kai
User last name [user]: ma
Email [admin@fab.org]: 1053667066@qq.com
Password:
Repeat for confirmation:
Recognized Database Authentications.
Admin User makai created.

root@VM-32-248-ubuntu:~# docker exec -it a01f392582bb superset db upgrade
INFO [alembic.runtime.migration] Context impl SQLiteImpl.
INFO [alembic.runtime.migration] Will assume transactional DDL.
INFO [alembic.runtime.migration] Running upgrade -> 4e6a06bad7a8, Init
INFO [alembic.runtime.migration] Running upgrade 4e6a06bad7a8 -> 5a7bad26f2a7, empty message
INFO [alembic.runtime.migration] Running upgrade 5a7bad26f2a7 -> 1e2841a4128, empty message
INFO [alembic.runtime.migration] Running upgrade 1e2841a4128 -> 2929af7925ed, TZ offsets in data sources
INFO [alembic.runtime.migration] Running upgrade 2929af7925ed -> 289ce07647b, Add encrypted password field
INFO [alembic.runtime.migration] Running upgrade 289ce07647b -> 1a48a5411020, adding slug to dash
INFO [alembic.runtime.migration] Running upgrade 1a48a5411020 -> 315b3f4da9b0, adding log model
INFO [alembic.runtime.migration] Running upgrade 315b3f4da9b0 -> 55179c7f25c7, sqla_descr
INFO [alembic.runtime.migration] Running upgrade 55179c7f25c7 -> 12d55656cbca, is_featured
......

root@VM-32-248-ubuntu:~# docker exec -it a01f392582bb superset init
2018-02-10 12:49:55,189:INFO:root:Syncing role definition
2018-02-10 12:49:55,190:INFO:root:Creating database reference
2018-02-10 12:49:55,256:INFO:root:Syncing Admin perms
2018-02-10 12:49:55,358:INFO:root:Syncing Alpha perms
2018-02-10 12:49:55,833:INFO:root:Syncing Gamma perms
2018-02-10 12:49:56,204:INFO:root:Syncing granter perms
2018-02-10 12:49:56,594:INFO:root:Syncing sql_lab perms
2018-02-10 12:49:57,072:INFO:root:Fetching a set of all perms to lookup which ones are missing
2018-02-10 12:49:57,167:INFO:root:Creating missing datasource permissions.
2018-02-10 12:49:57,177:INFO:root:Creating missing database permissions.
2018-02-10 12:49:57,198:INFO:root:Creating missing metrics permissions


root@VM-32-248-ubuntu:~# docker exec -it a01f392582bb superset runserver
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

[2018-02-10 12:53:47 +0000] [1233] [INFO] Starting gunicorn 19.7.1
[2018-02-10 12:53:47 +0000] [1233] [INFO] Listening at: http://0.0.0.0:8088 (1233)
[2018-02-10 12:53:47 +0000] [1233] [INFO] Using worker: sync
[2018-02-10 12:53:47 +0000] [1236] [INFO] Booting worker with pid: 1236
[2018-02-10 12:53:47 +0000] [1237] [INFO] Booting worker with pid: 1237

访问superset

  • 使用浏览器打开:http://ip:8088
  • 使用用户名和密码登录

superset界面