目录
因为安装Superset需要Python3.7的环境,为了实现一个机器不同版本的Python,所以可以通过Miniconda来在不同的Python环境中进行切换
官网地址:https://conda.io/en/latest/miniconda.html
执行命令:bash Miniconda3-latest-Linux-x86_64.sh
接下就是一直回车空格
这里设置安装路径
conda config --set auto_activate_base false
重回base命令:conda activate base
conda自带3.7的python环境,这里主要是为了学习conda命令,所以可以跳过
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 create -n superset python=3.7 # 创建环境superset
conda info --envs # 查看所有环境
#conda remove -n superset --all # 删除环境superset
conda activate superset # 切换到 superset 环境
python -V # 检查环境
conda deactivate # 退出当前环境
yum install gcc gcc-c++ libffi-devel python-devel python-pip python-wheel python-setuptools openssl-devel cyrus-sasl-devel openldap-devel
pip install --upgrade setuptools pip -i https://pypi.douban.com/simple
pip install apache-superset -i https://pypi.douban.com/simple
superset db upgrade
这里我出现了error:ImportError: cannot import name ‘soft_unicode’ from ‘markupsafe’,是因为markupsafe的问题,解决:pip install markupsafe==2.0.1 将markupsafe进行降级处理
export FLASK_APP=superset
superset fab create-admin
修改用户时:进入root用户下隐藏文件删除superset.db,然后初始化,重新创建
superset init
pip install gunicorn -i https://pypi.douban.com/simple ,gunicorn是一个web Server,和java中的tomcat类似
gunicorn --workers 5 --timeout 120 --bind 92.168.163.201:8787:8787 "superset.app:create_app()" --daemon
ps -ef | awk '/superset/ && !/awk/{print $2}' | xargs kill -9
#!/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 0.0.0.0:8787 --daemon "superset.app:create_app()"
else
echo "superset is running."
fi
}
superset_stop(){
superset_status >/dev/null 2>&1
if [[ $? -eq 0 ]]; then
echo "superset is not run."
else
ps -ef | awk '/gunicorn/ && !/awk/{print $2}' | xargs kill -9
fi
}
case $1 in
start )
echo "start superset..."
superset_start
;;
stop )
echo "stop superset..."
superset_stop
;;
restart )
echo "restart superset..."
superset_stop
superset_start
;;
status )
superset_status >/dev/null 2>&1
if [[ $? -eq 0 ]]; then
echo "superset is not run."
else
echo "superset is running."
fi
esac
设置执行权限:chmod +x
后续执行命令:
superset.sh status
superset.sh start
superset.sh stop
conda install mysqlclient
hive的依赖:conda install pyhive
手机扫一扫
移动阅读更方便
你可能感兴趣的文章