官方文档安装
安装环境为centos7,python3.7,python3.7环境配置:https://segmentfault.com/a/1190000015628625#articleHeader1
教程参考:
问题:
1 | Could not install packages due to an EnvironmentError: [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] de |
使用豆瓣pip源:
1 | pip install superset -i https://pypi.douban.com/simple/ --trusted-host pypi.douban.com |
问题:
1 | Was unable to import superset Error: cannot import name '_maybe_box_datetimelike' from 'pandas.core.common' (/usr/bin/venv/lib/python3.7/site-packages/pandas/core/common.py) |
解决方法:跟pandas版本有关,卸载掉重装低版本:https://github.com/apache/incubator-superset/issues/6770:
1 | pip uninstall pandas |
问题:
1 | sqlalchemy.exc.InvalidRequestError: Can't determine which FROM clause to join from, there are multiple FROMS which can join to this entity. Try adding an explicit ON clause to help resolve the ambiguity. |
解决方法https://github.com/apache/incubator-superset/issues/6977:
1 | pip install sqlalchemy==1.2.18 |
连接clickhouse时出现报错:
1 | sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:clickhouse |
解决方法:
安装专门支持clickhouse的sqlalchemy :https://github.com/cloudflare/sqlalchemy-clickhouse
1 | pip install sqlalchemy-clickhouse |
安装pip install mysqlclient (安装多种数据源客户端以支持多种)出错:
1 | OSError: mysql_config not found |
解决:
1 | yum install mysql-devel gcc gcc-devel python-devel |
superset_config添加mysql配置:
1 | mysql://root:123456@10.12.222.212/superset?charset=utf8 |
docker 镜像部署到k8s
k8s部署问题:
- 数据库初始化。
- 镜像选择;
- namespace选择;
- 不配置redis的使用。
- kubectl exec -ti ${your_pods_name} – 初始化,尝试容器初始化
- docker时区
部署形态:
- 将superset元数据的存储改为外部的mysql,缓存依赖于redis。
- k8s中superset为5个pod,其依赖的redis 只为一个pod,只是为了减少有缓存轮空情况,暂无k8s中搭建redis集群打算。
- 通过
nodePort
方式暴露服务,通过内部域名访问服务。
创建数据库:
1 | CREATE DATABASE superset CHARACTER SET utf8 COLLATE utf8_general_ci; |
制作docker镜像:
dockerfile如下:
1 | FROM amancevice/superset:0.29.0rc7 |
sources.list
和pip.conf
和为国内debian源和pip源,superset_config.py为自定义的superset配置文件,都与dockerfile位于同一目录下即可。
superset自定配置文件内容如下:
1 | import os |
配置文件中使用了redis缓存,并且使用的外部MySQL。
k8s yaml编写
superset_deployment.yaml:
1 | apiVersion: apps/v1 |
superset_service.yaml:
1 | apiVersion: v1 |
redis_deployment.yaml:
1 | apiVersion: apps/v1 |
superset_service.yaml:
1 | apiVersion: v1 |
初始化数据库:
部署到k8s中之后需要初始化数据库,初始化命令如下:
1 | kubectl exec -ti ${your_pods_name} -- superset-init |
之后按照提示操作即可。
仓库登陆问题:
1 | Get https://mirror.jd.com/v2/: dial tcp 172.28.217.53:443: connect: connection refused |
解决:
配置文件/usr/lib/systemd/system/docker.service
中添加--insecure-registry=mirror.jd.com
:
1 | ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --insecure-registry=mirror.jd.com |
或者/etc/docker/daemon.json中添加"insecure-registries": ["mirror.jd.com"]
:
1 | { |
注意:域名后面不添加端口。并且这两处不可以同时配置,只能选其一,要不然无法重启docker。
更详细的报错信息可通过系统日志来看:
1 | tail -f /var/log/messages |