Docker 安装
1. 拉取稳定版
docker run --rm --network host --name superset amancevice/superset:2.1.02. 配置MySQL 数据库存储
5.7 或 8.0 均适用
创建 superset 用户并配置远程访问
SQL
1
2
3
create user superset
identified by 'superset'; SQL
1
2
3
4
# MysQL 5.7
GRANT ALL PRIVILEGES ON *.* TO 'superset'@'%' IDENTIFIED BY 'superset' WITH GRANT OPTION;
# MySQL 8.0
GRANT ALL PRIVILEGES ON *.* TO 'superset'@'%' WITH GRANT OPTION;3.配置 Redis 缓存
安装过程忽略
4. 自定义配置 superset
存储到 MySQL, 缓存到 Redis
创建配置目录
纯文本
1
mkdir -p /etc/superset创建配置文件
纯文本
1
2
cd /etc/superset/
touch superset_config.py/etc/superset/superset_config.pyPython
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import os
# MAPBOX_API_KEY = os.getenv("MAPBOX_API_KEY", "")
CACHE_CONFIG = {
"CACHE_TYPE": "RedisCache",
"CACHE_DEFAULT_TIMEOUT": 300,
"CACHE_KEY_PREFIX": "superset_",
"CACHE_REDIS_HOST": "redis",
"CACHE_REDIS_PORT": 6379,
"CACHE_REDIS_DB": 1,
"CACHE_REDIS_URL": "redis://redis.example.com:6379/11",
}
FILTER_STATE_CACHE_CONFIG = {**CACHE_CONFIG, "CACHE_KEY_PREFIX": "superset_filter_"}
EXPLORE_FORM_DATA_CACHE_CONFIG = {**CACHE_CONFIG, "CACHE_KEY_PREFIX": "superset_explore_form_"}
SQLALCHEMY_DATABASE_URI = "mysql://superset:superset@mysql.example.com:3306/superset?charset=utf8mb4"
SQLALCHEMY_TRACK_MODIFICATIONS = True
SECRET_KEY = "thisISaSECRET_1234"
5.启动
指定自定义配置项 superset_config.py-v /etc/superset:/etc/superset指定端口映射到主机的 28088 端口-p 28088:8088
纯文本
1
docker run -d --restart always -v /etc/superset:/etc/superset --name superset amancevice/superset:2.1.06.首次启动后需要初始化
纯文本
1
docker exec -it superset superset-init配置用户名 / 密码
纯文本
1
2
3
4
5
6
7
8
9
10
[root@jansora superset]# docker exec -it superset superset-init
Username [admin]: admin
User first name [admin]:
User last name [user]:
Email [admin@fab.org]:
Password:
Repeat for confirmation:
Loaded your LOCAL configuration at [/etc/superset/superset_config.py]
logging was configured successfully
...7. 配置到 nginx
Bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
server {
listen 443 ssl http2;
server_name superset.jansora.app;
# ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_certificate /etc/openresty/certs/lets-encrypt-jansora.app/jansora.app.crt;
ssl_certificate_key /etc/openresty/certs/lets-encrypt-jansora.app/jansora.app.key;
location / {
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_pass http://127.0.0.1:28088;
}
}访问测试
Kubernetes 安装 superset
与 Docker 安装类似
1.2.3.4 步骤同 Docker 安装
忽略
5. 配置到 ConfigMap
Bash
1
kubectl create configmap superset-config --from-file=/etc/superset/superset_config.py6. 配置 Deployment
YAML
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
apiVersion: apps/v1
kind: Deployment
metadata:
name: superset
spec:
selector:
matchLabels:
app: superset
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 20
maxUnavailable: 20
replicas: 1
template:
metadata:
labels:
app: superset
spec:
containers:
- name: superset
image: amancevice/superset:2.1.0
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8088
volumeMounts:
- name: config-volume
mountPath: /etc/superset/superset_config.py
subPath: superset_config.py
volumes:
- name: config-volume
configMap:
name: superset-config
7. 配置 Service
YAML
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
apiVersion: v1
kind: Service
metadata:
name: superset-service
spec:
type: ClusterIP
selector:
app: superset
ports:
- protocol: TCP
port: 8080
targetPort: 8088
name: http
8. 配置 ingress
YAML
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: superset-ingress
spec:
ingressClassName: nginx
rules:
- host: superset.kubernetes.jansora.com
http:
paths:
- backend:
service:
name: superset-service
port:
number: 8080
pathType: Prefix
path: /9. 初始化
Bash
1
2
3
4
5
6
root@master:~# kubectl get pods | grep superset
superset-665796cd87-5l4l7 1/1 Running 0 5h3m
root@master:~# kubectl exec -it superset-665796cd87-5l4l7 -- superset-init
...
init log
...转发
Bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
server {
listen 443 ssl http2;
server_name superset.jansora.com;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_certificate /etc/openresty/certs/lets-encrypt-jansora.com/jansora.com.crt;
ssl_certificate_key /etc/openresty/certs/lets-encrypt-jansora.com/jansora.com.key;
location / {
proxy_pass http://kubernetes;
proxy_set_header Host superset.kubernetes.jansora.com;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;
proxy_set_header Accept-Encoding gzip;
}
}
访问测试
附: MAC 安装手稿
cd /Users/jansora/Librarypython3 -m venv supersetexport SUPERSET_HOME=/Users/jansora/Library/superset$SUPERSET_HOME/bin/pip3 install apache-superset pillow -i https://pypi.tuna.tsinghua.edu.cn/simple$SUPERSET_HOME/bin/superset db upgrade$SUPERSET_HOME/bin/superset fab create-admin nohup /Users/jansora/Library/superset/bin/superset run -p 19088 >/Users/jansora/Library/superset/superset.log 2>&1 &纯文本
1
2
3
4
5
6
7
8
Username [admin]:
User first name [admin]:
User last name [user]:
Email [admin@fab.org]:
Password: admin
Repeat for confirmation: admin
Recognized Database Authentications.
Admin User admin created../superset load_examples
./superset init- 配置驱动
纯文本
1
2
3
4
5
6
7
8
# Oracle
$SUPERSET_HOME/bin/pip3 install cx_Oracle -i https://pypi.tuna.tsinghua.edu.cn/simple
# Mysql
$SUPERSET_HOME/bin/pip3 install mysqlclient -i https://pypi.tuna.tsinghua.edu.cn/simple
superset 4.4 更新
初始化
进入容器, 执行
纯文本
1
2
3
4
5
6
7
8
9
10
11
12
superset db upgrade
superset fab create-admin \
--username admin \
--email admin@superset.com \
--password admin \
--firstname Superset \
--lastname Admin
superset init
superset load_examples

评论栏
分享你的想法,或参与下面的讨论。
参与讨论
支持 Markdown、代码和图片
友善交流,让讨论更有价值。
更多留言
加载中…