目录
装python环境
安装miniconda
创建python3.7环境
superset部署
安装surperset
启动surperset
surperset启停脚本
superset使用
[doudou@hadoop102 superset]$ ll
total 70104
-rw-r--r--. 1 doudou doudou 71785000 9月 28 07:35 Miniconda3-latest-Linux-x86_64.sh
[doudou@hadoop102 superset]$ bash Miniconda3-latest-Linux-x86_64.sh
加载配置文件,使之生效
[doudou@hadoop102 superset]$ source ~/.bashrc
Miniconda安装完成后,每次打开终端都会激活其默认的base环境,我们可通过以下命令,禁止激活默认base环境。
(base) [doudou@hadoop102 superset]$ conda config --set auto_activate_base false
[doudou@hadoop102 ~]$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
[doudou@hadoop102 ~]$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
[doudou@hadoop102 ~]$ conda config --set show_channel_urls yes
[doudou@hadoop102 ~]$ conda create --name superset python=3.7
创建环境:conda create -n env_name
查看所有环境:conda info --envs
删除一个环境:conda remove -n env_name --all
激活
[doudou@hadoop102 ~]$ conda activate superset
(superset) [doudou@hadoop102 ~]$
退出
(superset) [doudou@hadoop102 ~]$ conda deactivate
[doudou@hadoop102 ~]$
安装依赖
(superset) [atguigu@hadoop102 ~]$ sudo yum install -y gcc gcc-c++ libffi-devel python-devel python-pip python-wheel python-setuptools openssl-devel cyrus-sasl-devel openldap-devel
1)安装(更新)setuptools和pip
(superset) [atguigu@hadoop102 ~]$ pip install --upgrade setuptools pip -i https://pypi.douban.com/simple/
2)安装Supetset
(superset) [atguigu@hadoop102 ~]$ pip install apache-superset -i https://pypi.douban.com/simple/
3)初始化Supetset数据库
(superset) [atguigu@hadoop102 ~]$ superset db upgrade
4)创建管理员用户
(superset) [atguigu@hadoop102 ~]$ export FLASK_APP=superset
(superset) [atguigu@hadoop102 ~]$ superset fab create-admin
5)Superset初始化
(superset) [atguigu@hadoop102 ~]$ superset init
1)安装gunicorn
(superset) [atguigu@hadoop102 ~]$ pip install gunicorn -i https://pypi.douban.com/simple/
2)停止superset
(superset) [atguigu@hadoop102 ~]$ ps -ef | awk '/superset/ && !/awk/{print $2}' | xargs kill -9
[doudou@hadoop102 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) [atguigu@hadoop102 ~]$ conda install mysqlclient
重启
(superset) [atguigu@hadoop102 ~]$ superset.sh restart