Superset

       Apache Superset是一个开源的、现代的、轻量级BI分析工具,能够对接多种数据源、拥有丰富的图表展示形式、支持自定义仪表盘,且拥有友好的用户界面,十分易用。

创建Python3.7环境

1)配置conda国内镜像

[atguigu@hadoop102 ~]$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free


[atguigu@hadoop102 ~]$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main


[atguigu@hadoop102 ~]$ conda config --set show_channel_urls yes


2)创建Python3.7环境

[atguigu@hadoop102 ~]$ conda create --name superset python=3.7

conda环境管理常用命令

创建环境:conda create -n env_name

查看所有环境:conda info --envs

删除一个环境:conda remove -n env_name --all

3)激活superset环境

[atguigu@hadoop102 ~]$ conda activate superset

4)执行python命令查看python版本

[atguigu@hadoop102 ~]$ python

Superset部署

安装依赖

安装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

安装Superset 

1)安装setuptools和pip‘

 [atguigu@hadoop102 ~]$ pip install --upgrade setuptools pip -i https://pypi.douban.com/simple/

2)安装Supertset

[atguigu@hadoop102 ~]$ pip install apache-superset -i https://pypi.douban.com/simple/

3) 初始话Supetset数据库

[atguigu@hadoop102 ~]$ superset db upgrade

4)创建管理员用户

[atguigu@hadoop102 ~]$ export FLASK_APP=superset
[atguigu@hadoop102 ~]$ superset fab create-admin

5)Superset初始化

[atguigu@hadoop102 ~]$ superset init

启动Supterset

1)安装Supterser 

[atguigu@hadoop102 ~]$ pip install gunicorn -i https://pypi.douban.com/simple/

2)启动

 [atguigu@hadoop102 ~]$ gunicorn --workers 5 --timeout 120 --bind hadoop102:8787  "superset.app:create_app()" --daemon 

workers : 指定进程个数

tiomeout:worker进程超时时间,超时会自动重启

bind:绑定本机地址,即为Superset访问地址

daemon:后台运行

3)登陆Superset

访问http://hadoop102:8787,并使用创建的管理员账号进行登录。

4)停止superset

停掉gunicorn进程

(superset) [atguigu@hadoop102 ~]$ ps -ef | awk '/superset/ && !/awk/{print $2}' | xargs kill -9

退出superset环境
(superset) [atguigu@hadoop102 ~]$ conda deactivate

superset启停脚本

# 创建并写入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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值