BI技术调研----工具对比及Surperset 之 docker安装与可视化

作者:流川疯
同步发表于:https://season.blog.csdn.net/article/details/88071469



1. BI 技术选型对比

假如客户有一堆数据要分析,没有太多行业知识的你需要在一周之内给出基本的可视化展现怎么办?别担心,有BI软件来帮你

1.1 总体对比

ES+kibana Tableau Superset redash
官网链接 https://www.elastic.co/products/kibana https://www.tableau.com/ http://superset.apache.org/,https://github.com/apache/incubator-superset/ https://redash.io/
部署安装 本地云端部署均可 Tableau 后端连接数据库,数据库在本地云端均可。 本地+docker https://redash.io/help/open-source/setup
优势 ES属于大数据新贵,已有部分最佳实践开源,支持部分定制,支持分布式,非结构化数据检索,速度快,产品成熟 运维成本低,产品成熟,支持基本所有数据库社区支持ES 软件成本低,支持深度定制,开源社区最高评价的BI软件 对SQL
缺陷 需要对索引等ES 概念有所理解才能良好使用kibana,需要再次录入结构化数据到ES并准备一套数据schema mapper 收费 文档成熟度欠缺,绘图报错不显示错误信息,默认地图服务商为国外厂商 汉化支持,文档支持较差
汉化支持 没有汉化版本,图表可自定义名称,座标轴 支持国际化 支持国际化 不支持汉化,且国际化支持时间不定。文档最差的一个,他的文档在官网叫help
图例 https://www.elastic.co/cn/products/kibana 下载官方白皮书:https://www.tableau.com/sites/default/files/media/whitepaper_surveydata_v4.pdf (还要注册差评) http://superset.apache.org/gallery.html https://redash.io/help/user-guide/visualizations/visualization-types
支持的数据源 Elastic Search https://onlinehelp.tableau.com/current/pro/desktop/en-us/exampleconnections_overview.htm http://superset.apache.org/installation.html#database-dependencies https://redash.io/help/data-sources/setup/supported-data-sources
是否支持ES 支持 社区提供连接器,https://github.com/mradamlacey/elasticsearch-tableau-connector 不支持 不支持

除了上述提到的一些产品外,我们还有国产的一家厂商:

1.2 硬件要求

上述BI 组件的硬件需求基本可以参考Tableau给出的

Tableau Server 的系统要求:(最高版需求)

最低系统要求

  • 2 核
  • 64 位处理器
  • 8 GB 系统内存
  • 至少 15 GB 可用磁盘空间

建议要求

  • 8 个物理内核,2.0 GHz 或更高频率的 CPU
  • 64 位处理器
  • 32 GB 系统内存
  • 至少 50 GB 可用磁盘空间

2. docker 安装Superset

下面我们选择Superset 来实战一下,看看效果到底怎么样。

2.1 Centos 安装docker

参照官网的安装简介

git clone https://github.com/apache/incubator-superset/
cd incubator-superset/contrib/docker
# prefix with SUPERSET_LOAD_EXAMPLES=yes to load examples:
docker-compose run --rm superset ./docker-init.sh
# you can run this command everytime you need to start superset now:
docker-compose up

实在不想用windows 下面那个hyper-v 的docker 我就在virtual box 中安装 一个CentOS7 搞一搞 docker

过程无非是:

sudo yum update
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum list docker-ce --showduplicates | sort -r
sudo yum install docker-ce 
yum install docker-ce-18.06.2.ce
systemctl start docker
systemctl enable docker
docker version

具体可以参考
https://www.cnblogs.com/yufeng218/p/8370670.html

2.2 参照SuperSet 官网编译官网版docker

装好docker 后就是安装python 主要是为了使用python 然后docker-compose 结果直接报错:

Step 13/21 : COPY --chown=superset:superset superset superset
ERROR: Service 'superset' failed to build: Unknown flag: chown

参考解决方案:(可能是docker 更新了,Surperset的docker file 还没有更新?)

https://forums.docker.com/t/copy-chown-fails-in-automated-build-unknown-flag-chown/43059

修改成如下形式,继续运行,ok

运行命令:

接着报错,一看就是权限问题,TMD


superset_superset_1 exited with code 243
superset_1  | npm ERR! path /home/superset/superset/assets/node_modules
superset_1  | npm ERR! code EACCES
superset_1  | npm ERR! errno -13
superset_1  | npm ERR! syscall mkdir
superset_1  | npm ERR! Error: EACCES: permission denied, mkdir '/home/superset/superset/assets/node_modules'
superset_1  | npm ERR!  { [Error: EACCES: permission denied, mkdir '/home/superset/superset/assets/node_modules']
superset_1  | npm ERR!   cause:
superset_1  | npm ERR!    { Error: EACCES: permission denied, mkdir '/home/superset/superset/assets/node_modules'
superset_1  | npm ERR!      type: 'OperationalError',
superset_1  | npm ERR!      '$error': '$error',
superset_1  | npm ERR!      cause:
superset_1  | npm ERR!       { errno: -13,
superset_1  | npm ERR!         code: 'EACCES',
superset_1  | npm ERR!         syscall: 'mkdir',
superset_1  | npm ERR!         path: '/home/superset/superset/assets/node_modules' },
superset_1  | npm ERR!      isOperational: true,
superset_1  | npm ERR!      errno: -13,
superset_1  | npm ERR!      code: 'EACCES',
superset_1  | npm ERR!      syscall: 'mkdir',
superset_1  | npm ERR!      path: '/home/superset/superset/assets/node_modules' },
superset_1  | npm ERR!   isOperational: true,
superset_1  | npm ERR!   stack:
superset_1  | npm ERR!    'Error: EACCES: permission denied, mkdir \'/home/superset/superset/assets/node_modules\'',
superset_1  | npm ERR!   type: 'OperationalError',
superset_1  | npm ERR!   '$error': '$error',
superset_1  | npm ERR!   errno: -13,
superset_1  | npm ERR!   code: 'EACCES',
superset_1  | npm ERR!   syscall: 'mkdir',
superset_1  | npm ERR!   path: '/home/superset/superset/assets/node_modules' }
superset_1  | npm ERR! 
superset_1  | npm ERR! The operation was rejected by your operating system.
superset_1  | npm ERR! It is likely you do not have the permissions to access this file as the current user
superset_1  | npm ERR! 
superset_1  | npm ERR! If you believe this might be a permissions issue, please double-check the
superset_1  | npm ERR! permissions of the file and its containing directories, or try running
superset_1  | npm ERR! the command again as root/Administrator (though this is not recommended).
superset_1  | 
superset_1  | npm ERR! A complete log of this run can be found in:
superset_1  | npm ERR!     /home/superset/.npm/_logs/2019-02-22T04_42_13_898Z-debug.log
superset_superset_1 exited with code 243

解决方案:
https://stackoverflow.com/questions/54049266/superset-npm-eacces-permission-denied-mkdir
结果没好,暴力加个权限:
chmod 777 (superset的当前目录及上一级目录)
其实主要是docker 里面没有操作他挂载目录中的权限,提升一下权限就好了。

结果页面成这样了
在这里插入图片描述
调试一下,304 错误,我前端没什么储备,等高手来救场了。
在这里插入图片描述

2.3 使用其他人制作好的docker

还是用别人搞好的吧,参考:

https://www.jianshu.com/p/d5978b439080

命令如下

# 0e9131be7e49    为docker ps 中的id
# 先建一个/data文件夹方便映射
docker run -d -p 8088:8088 -v /data:/home/superset amancevice/superset:0.28.1

docker exec -it 0e9131be7e49  fabmanager create-admin --app superset
docker exec -it 0e9131be7e49  superset db upgrade
# 加载例子,这一步我看日志还要数据库建立索引啥的,时间较长,不需要可以不用
docker exec -it 0e9131be7e49  superset load_examples
docker exec -it 0e9131be7e49  superset init
docker exec -it 0e9131be7e49  superset runserver

自带世界银行数据的BI看板,效果爆炸有木有
在这里插入图片描述

2.4 使用自己的sqllite 数据源分析

假如客户给了一个数据库,或者一堆csv怎么办,别担心,我们的superset 对外接数据源支持还是非常出色的,对于中小型关注成本的企业来说,BI无压力。csv ,sqllite,mysql 通通连上来。

下面我们用sqllite来小试牛刀。

由于sqllite不支持远程链接,我们的docker 之前挂载到宿主机的一个目录上面
这个数据库是我在NLP系列里面用爬虫爬的我自己的博客,主要包括标签,发表时间,点赞数,评论数等内容。
在这里插入图片描述
链接字符串如下

sqlite:////home/superset/NLP_demo.db

记得点击可以在 SQL 工具箱中公开,这样我们才可以在SQL工具箱中加载并找到这个数据库。
在这里插入图片描述
点击测试,seems ok 说明正常。
在这里插入图片描述
打开sql工具箱,写完sql 就可以用这个子数据集进行一些BI分析了,但是由于我之前的数据库很多列的格式没有统计,所以画图会有一些问题,这一点superset 在导入数据库数据时候似乎不能很友好的再次修改。

在这里插入图片描述

我选择饼图,统计一下博客中那一个标签下面发的文章最多,毫无疑问 OpenCV,尽管最近都基本没有再发过了。

在这里插入图片描述


参考文献

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章