028 大数据之Superset商业智能

Apache Superset

试用了5款BI分析工具,终于找到了上手最快的那一个!
superset安装及简单使用
四款热门数据可视化BI产品调研

# 安装Miniconda
[atguigu@hadoop102 lib]$ bash Miniconda3-latest-Linux-x86_64.sh
# 进入 conda base 环境
conda activate base
# 退出 conda base 环境
conda deactivate
# 编辑 conda 环境变量
vim ~/.bashrc
# 禁止激活默认base环境
conda config --set auto_activate_base false

conda 镜像杂谈
创建环境:conda create -n env_name
查看所有环境:conda info --envs
删除一个环境:conda remove -n env_name --all

# 配置conda国内镜像
[atguigu@hadoop102 software]$ conda activate base
(base) [atguigu@hadoop102 software]$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
(base) [atguigu@hadoop102 software]$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
(base) [atguigu@hadoop102 software]$ conda config --set show_channel_urls yes

尚硅谷大数据数仓项目superset db upgrade三个报错解答
安装superset

# 创建Python3.8环境
(base) [atguigu@hadoop102 software]$ conda create --name superset python=3.8
# 激活superset环境
(base) [atguigu@hadoop102 software]$ conda activate superset
# 安装依赖、更新依赖
(superset) [atguigu@hadoop102 software]$ 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) [atguigu@hadoop102 software]$ pip install --upgrade setuptools pip -i https://pypi.douban.com/simple/
# 安装Supetset
(superset) [atguigu@hadoop102 software]$ pip install apache-superset -i https://pypi.douban.com/simple/
# 初始化Supetset数据库
(superset) [atguigu@hadoop102 software]$ superset db upgrade
ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/opt/module/miniconda3/envs/superset/lib/python3.8/site-packages/markupsafe/__init__.py)
# soft_unicode在高版本被移除,使用如下版本可以
(superset) [atguigu@hadoop102 software]$ python -m pip install markupsafe==2.0.1
# 创建管理员用户
(superset) [atguigu@hadoop102 software]$ export FLASK_APP=superset
(superset) [atguigu@hadoop102 software]$ superset fab create-admin
2022-05-16 21:34:22,686:INFO:superset.utils.screenshots:No PIL installation found
# 解决报错
(superset) [atguigu@hadoop102 software]$ pip install pillow
# Superset初始化
(superset) [atguigu@hadoop102 ~]$ superset init

启动superset

# 安装gunicorn(类似TomCat)
(superset) [atguigu@hadoop102 software]$ pip install gunicorn -i https://pypi.douban.com/simple/
# 开启5个进程,并设置进程超时自动重启阈值,绑定Superset访问地址,后台运行
(superset) [atguigu@hadoop102 software]$ gunicorn --workers 5 --timeout 120 --bind hadoop102:8787  "superset.app:create_app()" --daemon 
# 停掉gunicorn进程
(superset) [atguigu@hadoop102 software]$ ps -ef | awk '/superset/ && !/awk/{print $2}' | xargs kill -9

superset启停脚本

[atguigu@hadoop102 bin]$ cat 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

使用jieky登录Superset:http://hadoop102:8787
Superset在生产Country Map时,地区码要使用ISO 3166-2编码
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值