0.37.1superset安装教程

superset安装教程

首先依赖安装

yum install gcc gcc-c++ libffi-devel python-devel python-pip python-wheel openssl-devel libsasl2-devel openldap-devel
  1. 官网下载Anconda https://www.anaconda.com/products/distribution#Downloads
  2. 安装
    sh Anaconda3-2022.10-Linux-x86_64.sh
  3. 环境配置
    在 /etc/profile中加入以下语句:
export PATH=$PATH:/root/anaconda3/bin
source /etc/profile
  1. 安装python3.6环境
conda create -n python36 python=3.6
  1. 激活python环境
conda activate python36【激活使用python36环境,需要先执行下】

source activate 【初始化conda,必须执行,执行之后可以使用conda命令激活环境】
conda deactivate 【退出当前base环境】
conda activate python36【激活使用python36环境】
conda deactivate 【退出当前使用python36环境】
conda remove -n python36 --all 【删除python36环境】

  1. 安装supserset

注意在这个地方
(python36) [root@localhost ~]#


pip install apache-superset==0.37.1 -i https://pypi.tuna.tsinghua.edu.cn/simple

superset db upgrade

注意:如果在安装初始化过程中出现“ImportError: cannot import name ‘_ColumnEntity’ from ‘sqlalchemy.orm.query’ (/home/cod7/superset-env/lib/python3.8/site-packages/sqlalchemy/orm/query.py)”错误,以上错误是由于SQLAlchemy包版本太高导致,按照以下步骤解决:

pip uninstall SQLAlchemy
pip install sqlalchemy==1.3.24
#创建用户名和密码
superset fab create-admin  【创建用户名和密码】
superset init 【初始化】

superset run -h 0.0.0.0 -p 8088
#注意:-p 8088来指定端口启动服务,-h 0.0.0.0是避免只能本地访问superset服务

gunicorn --workers 5 --timeout 120 --bind 192.168.1.132:8088 "superset.app:create_app()" --daemon

--workers:指定进程个数
--timeout:worker 进程超时时间,超时会自动重启
--bind:绑定本机地址,即为 Superset 访问地址
--daemon:后台运行
#停止后台服务
ps -ef | awk '/gunicorn/ && !/awk/{print $2}' | xargs kill -9

其他

设置自动激活为false

 conda config --set auto_activate_base false

国内常用源镜像地址:

清华:https://pypi.tuna.tsinghua.edu.cn/simple
阿里云:https://mirrors.aliyun.com/pypi/simple/
中国科技大学: https://pypi.mirrors.ustc.edu.cn/simple/
华中理工大学:https://pypi.hustunique.com/
山东理工大学:https://pypi.sdutlinux.org/
豆瓣:https://pypi.douban.com/simple/

  1. 添加镜像源
    conda config --add channels https://mirrors.aliyun.com/anaconda/pkgs/free/
    conda config --add channels https://mirrors.aliyun.com/anaconda/pkgs/main/
    conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/conda-forge/
    Anaconda有两个修改默认设置的命令,如下:第一行语句代表添加命令,第二行代表删除命令,其中的key是指关键词,value指关键词对应的值,可以是某些链接或者文件位置。
添加删除命令
conda config --add key value 
conda config --remove key value 
添加镜像源
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 --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/

创建 superset.sh 文件

vi 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(){
	# 该段内容取自~/.bashrc,所用是进行 conda 初始化
	# >>> conda initialize >>>
	# !! Contents within this block are managed by 'conda init' !!
	__conda_setup="$('/opt/module/miniconda3/bin/conda''shell.bash' 'hook' 2> /dev/null)"
	if [ $? -eq 0 ]; then
		eval "$__conda_setup"
	else
		if [ -f"/opt/module/miniconda3/etc/profile.d/conda.sh" ]; then
		     . "/opt/module/miniconda3/etc/profile.d/conda.sh"
	else
			export PATH="/opt/module/miniconda3/bin:$PATH"
		fi
	fi
	unset __conda_setup
	# <<< conda initialize <<<
	superset_status >/dev/null 2>&1
	if [[ $? -eq 0 ]]; then
		conda activate superset ; gunicorn --workers 5 --timeout 120 --bind sc1: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

加执行权限
chmod +x superset.sh

superset.sh start
superset.sh stop
superset.sh status

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ChangeXuan

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值