当前位置:网站首页>Visualization - Superset installation and deployment
Visualization - Superset installation and deployment
2022-08-01 09:33:00 【Sisi】
1 Superset入门
1.1 Superset概述
Apache Superset是一个开源的、现代的、轻量级BI分析工具,能够对接多种数据源、拥有丰富的图表展示形式、支持自定义仪表盘,且拥有友好的用户界面,十分易用.
1.2 Superset应用场景
由于Superset能够对接常用的大数据分析工具,如Hive、Kylin、Druid等,且支持自定义仪表盘,故可作为数仓的可视化工具.
第2章 Superset安装及使用
Superset官网地址:http://superset.apache.org/
2.1 安装Python环境
Superset是由Python语言编写的Web应用,要求Python3.7的环境.(But the environment comes with itpython2.7.5版本)
2.1.1 安装Miniconda
conda是一个开源的包、环境管理器,可以用于在同一个机器上安装不同Python版本的软件包及其依赖,并能够在不同的Python环境之间切换,Anaconda包括Conda、Python以及一大堆安装好的工具包,比如:numpy、pandas等,Miniconda包括Conda、Python.
此处,我们不需要如此多的工具包,故选择MiniConda.
[[email protected] ~]$ cd /opt/software/
[[email protected]102 software]$ ll
[[email protected] software]$ mkdir superset
[[email protected] software]$ cd superset/
上传Miniconda安装包
Enter the interactive installation process
[[email protected] superset]$ bash Miniconda3-latest-Linux-x86_64.sh
回车翻行,more--空格翻页
注意:when typing the path,如果写错,需要删除时,需要按住Ctrl键删除.
加载环境变量配置文件,使之生效
[[email protected] lib]$ source ~/.bashrc
取消激活base环境
Miniconda安装完成后,每次打开终端都会激活其默认的base环境,我们可通过以下命令,禁止激活默认base环境.
[[email protected] lib]$ conda config --set auto_activate_base false
Now close and reopen the session,就可以了.
2.1.2 创建Python3.7环境
onda环境管理常用命令
创建环境:conda create -n env_name
查看所有环境:conda info --envs
删除一个环境:conda remove -n env_name --all
配置conda国内镜像(Too slow abroad when downloading environments,So configure the mirror first,切换到国内)
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
conda config --set show_channel_urls yes
创建Python3.7环境
[[email protected] ~]$ conda create --name superset python=3.7
2.2 Superset部署
2.2.1 安装依赖
安装Superset之前,需安装以下所需依赖
(superset) [[email protected] ~]$ sudo yum install -y gcc gcc-c++ libffi-devel python-devel python-pip python-wheel python-setuptools openssl-devel cyrus-sasl-devel openldap-devel
2.2.2 安装Superset
安装(更新)setuptools和pip
(superset) [[email protected] ~]$ pip install --upgrade setuptools pip -i https://pypi.douban.com/simple/
说明:pip是python的包管理工具,可以和centos中的yum类比
安装Supetset
(superset) [[email protected] ~]$ pip install apache-superset -i https://pypi.douban.com/simple/
说明:-i的作用是指定镜像,这里选择国内镜像
注:如果遇到网络错误导致不能下载,可尝试更换镜像
(superset) [[email protected] ~]$ pip install apache-superset --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple
初始化Supetset数据库
(superset) [[email protected] ~]$ superset db upgrade
(There are a lot of issues here due to version issues,Finally, I read a big guy's article and it was solved,In short, lowermarkupsafe的版本,‘python -m pip install markupsafe==2.0.1’,卸载原来的superset,‘conda remove -n superset --all’,Then follow the original procedure to reinstall,安装python3.9‘conda create --name superset python=3.9’,再重新激活superset环境,最后出现No module named 'werkzeug.wrappers.etag'Lower this situationwerkzeug版本就行,‘python -m pip install werkzeug==2.0.0’)For details, please refer to the following article
https://blog.csdn.net/qq1787546870/article/details/124582727
创建管理员用户
(superset) [[email protected] ~]$ export FLASK_APP=superset
(superset) [[email protected] ~]$ superset fab create-admin
Superset初始化
(superset) [[email protected] ~]$ superset init
2.2.3 启动Supterset
安装gunicorn
(superset) [[email protected] ~]$ pip install gunicorn -i https://pypi.douban.com/simple/
说明:gunicorn是一个Python Web Server,可以和java中的TomCat类比
启动Superset
确保当前conda环境为superset
(superset) [[email protected] ~]$ gunicorn --workers 5 --timeout 120 --bind hadoop102:8787 "superset.app:create_app()" --daemon
说明:
--workers:指定进程个数
--timeout:worker进程超时时间,超时会自动重启
--bind:绑定本机地址,即为Superset访问地址
--daemon:后台运行
登录Superset,访问http://hadoop102:8787
工作界面
停止superset
停掉gunicorn进程
(superset) [[email protected] ~]$ ps -ef | awk '/superset/ && !/awk/{print $2}' | xargs kill -9
退出superset环境
(superset) [[email protected] ~]$ conda deactivate
2.2.4 superset启停脚本
1)创建superset.sh文件
[[email protected] bin]$ vim superset.sh
内容如下
#!/bin/bash
superset_status(){
result=`ps -ef | awk '/gunicorn/ && !/awk/{print $2}' | wc -l`
if [[ $result -eq 0 ]]; then
return 0
else
return 1
fi
}
superset_start(){
source ~/.bashrc
superset_status >/dev/null 2>&1
if [[ $? -eq 0 ]]; then
conda activate superset ; gunicorn --workers 5 --timeout 120 --bind hadoop102:8787 --daemon 'superset.app:create_app()'
else
echo "superset正在运行"
fi
}
superset_stop(){
superset_status >/dev/null 2>&1
if [[ $? -eq 0 ]]; then
echo "superset未在运行"
else
ps -ef | awk '/gunicorn/ && !/awk/{print $2}' | xargs kill -9
fi
}
case $1 in
start )
echo "启动Superset"
superset_start
;;
stop )
echo "停止Superset"
superset_stop
;;
restart )
echo "重启Superset"
superset_stop
superset_start
;;
status )
superset_status >/dev/null 2>&1
if [[ $? -eq 0 ]]; then
echo "superset未在运行"
else
echo "superset正在运行"
fi
esac
添加权限
(superset) [[email protected] bin]$ chmod +x superset.sh
测试
启动superset
[[email protected] bin]$ superset.sh start
停止superset
[[email protected] bin]$ superset.sh stop
边栏推荐
- 179. 最大数
- HoloView 在 jyputer lab/notebook 不显示总结
- Static Pod, Pod Creation Process, Container Resource Limits
- Quantify daily work metrics
- leetcode-6134: Find the closest node to the given two nodes
- Intensive reading of ACmix papers, and analysis of its model structure
- 在GBase 8c数据库后台,使用什么样的命令来对gtm、dn节点进行主备切换的操作
- 【编程之外】当遮羞布被掀开,当人们开始接受一切
- 【STM32】入门(二):跑马灯-GPIO端口输出控制
- Redis 3.2.3 crashed by signal: 11 服务宕机问题排查
猜你喜欢
三子棋(C语言实现)
Leicester Weekly 304 6135. The longest ring in the picture Inward base ring tree
报告:想学AI的学生数量已涨200%,老师都不够用了
How to implement deep copy in js?
Yang Hui Triangle (C language implementation)
Meeting OA (Upcoming Meetings & All Meetings)
node 格式化时间的传统做法与高级做法(moment)
leetcode-6132:使数组中所有元素都等于零
Change Servlet project to SSM project
leetcode-6134:找到离给定两个节点最近的节点
随机推荐
Install GBase 8 c database, the error shows "Resource, how to solve?
朴素贝叶斯--学习笔记--基本原理及代码实现
基于MySql,Redis,Mq,ES的高可用方案解析
笔记。。。。
mysql在cmd的登录及数据库与表的基本操作
Holoview--Introduction
Detailed explanation of JVM runtime data area and JMM memory model
GBase 8s 锁分类
[Interview: Concurrency 39: Multithreading: Thread Pool] ThreadPoolExecutor Class - Submit, Stop
Mysql database deployment and initialization steps
Custom IP used in PCIE
leetcode-6133:分组的最大数量
ASP.NET Core 6框架揭秘实例演示[30]:利用路由开发REST API
在GBase 8c数据库后台,使用什么样的命令来对gtm、dn节点进行主备切换的操作
力扣周赛304 6135. 图中的最长环 内向基环树
HoloView -- Tabular Datasets
HoloView -- Tabular Datasets
【编程之外】当遮羞布被掀开,当人们开始接受一切
堆内存的介绍及应用(含例子)
JVM 运行时数据区与JMM 内存模型详解