使用docker运行轻量级BI工具superset
Superset 是一款由 Airbnb 开源的“现代化的企业级 BI(商业智能) Web 应用程序”,其通过创建和分享 dashboard,为数据分析提供了轻量级的数据查询和可视化方案。
最方便的搭建方法就是使用docker运行:
系统环境准备:
apt-get upgrade && apt-get update
安装docker
> apt install docker.io > systemctl start docker > systemctl enable docker
获取镜像
> docker search superset > docker pull amancevice/superset
启动superset镜像
> docker images REPOSITORY TAG IMAGE ID CREATED SIZE amancevice/superset latest 26506f00f388 5 weeks ago 1.4GB
# 创建挂载目录 > mkdir /data/superset -p # 启动 > docker run -d -p 8088:8088 --name superset -v /data/superset:/home/superset amancevice/superset:latest 18c22f0fc458b6b727f6b2705b69c5226c8471714f97740fe462daf3444be666 # 查看启动的容器 > docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 18c22f0fc458 amancevice/superset:latest "gunicorn superset:a…" 4 seconds ago Up 3 seconds (health: starting) 0.0.0.0:8088->8088/tcp jovial_nash
对superset进行初始化设置
# 创建用户名和密码 > docker exec -it -u root 18c22f0fc458 fabmanager create-admin --app superset # 初始化数据库 > docker exec -it 18c22f0fc458 superset db upgrade # 导入示例数据 > docker exec -it 18c22f0fc458 superset load_examples # 创建默认角色和权限 > docker exec -it 18c22f0fc458 superset init # 启动服务 > docker exec -it 18c22f0fc458 superset runserver
配置Oracle依赖并连接Oracle数据库
数据库依赖软件安装文档:
http://superset.apache.org/installation.html#database-dependencies
这里是在docker容器中安装依赖,Oracle客户端下载列表:
https://www.oracle.com/technetwork/database/database-technologies/instant-client/downloads/index.html
# 把下载的Oracle客户端包放在挂载目录: > cp instantclient-basic-linux.x64-11.2.0.4.0.zip /data/superset # 进入容器: > docker exec -it -u root 83a1cb4cf984 bash # 在容器内部安装Oracle客户端和cx_Oracle依赖包 > apt-get -y upgrade && apt-get -y update > apt-get install -y libaio1 > pip3 install cx_Oracle > mkdir /opt/oracle > unzip instantclient-basic-linux.x64-11.2.0.4.0.zip -d /opt/oracle/ > cd /opt/oracle/instantclient_11_2/ > ln -s libclntsh.so.11.1 libclntsh.so > ln -s libocci.so.11.1 libocci.so > echo /opt/oracle/instantclient_11_2 > /etc/ld.so.conf.d/oracle-instantclient.conf > ldconfig # 创建 tnsnames.ora 文件,配置Oracle连接信息: > mkdir -p /opt/oracle/instantclient_11_2/network/admin > echo ‘DB-NAME = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.66 )(PORT = 1521)) ) (CONNECT_DATA=(SERVICE_NAME=orcl)))‘ > /opt/oracle/instantclient_11_2/network/admin/tnsnames.ora > exit
以上步骤其实可以用dockerfile批量完成。
在浏览器打来 http://ip:8088,访问superset配置:
数据库连接详细配置见:
https://docs.sqlalchemy.org/en/13/core/engines.html#database-urls
相关推荐
王道革 2020-11-25
bwyyziq 2020-11-22
pigsmall 2020-11-19
changecan 2020-11-19
helloWorldAndYou 2020-11-16
nginxs 2020-11-14
红石丶 2020-11-13
WanKaShing 2020-11-12
yangkang 2020-11-12
滴水穿石点石成金 2020-11-12
张荣珍 2020-11-12
wuxunanjing 2020-11-11
魅惑青花瓷 2020-11-11
lihongtai 2020-11-09
yangkang 2020-11-09
worldsnow 2020-11-06
MichaelJScofield 2020-11-06
TaoTaoFu 2020-11-06