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,儘管最近都基本沒有再發過了。

在這裏插入圖片描述


參考文獻

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