• Superset


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

    创建Python3.7环境

    1)配置conda国内镜像

    1. [atguigu@hadoop102 ~]$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
    2. [atguigu@hadoop102 ~]$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    3. [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)创建管理员用户

    1. [atguigu@hadoop102 ~]$ export FLASK_APP=superset
    2. [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

    1. 停掉gunicorn进程
    2. (superset) [atguigu@hadoop102 ~]$ ps -ef | awk '/superset/ && !/awk/{print $2}' | xargs kill -9
    3. 退出superset环境
    4. (superset) [atguigu@hadoop102 ~]$ conda deactivate

    superset启停脚本

    1. # 创建并写入superset.sh文件
    2. #!/bin/bash
    3. superset_status(){
    4. result=`ps -ef | awk '/gunicorn/ && !/awk/{print $2}' | wc -l`
    5. if [[ $result -eq 0 ]]; then
    6. return 0
    7. else
    8. return 1
    9. fi
    10. }
    11. superset_start(){
    12. source ~/.bashrc
    13. superset_status >/dev/null 2>&1
    14. if [[ $? -eq 0 ]]; then
    15. conda activate superset ; gunicorn --workers 5 --timeout 120 --bind hadoop102:8787 --daemon 'superset.app:create_app()'
    16. else
    17. echo "superset正在运行"
    18. fi
    19. }
    20. superset_stop(){
    21. superset_status >/dev/null 2>&1
    22. if [[ $? -eq 0 ]]; then
    23. echo "superset未在运行"
    24. else
    25. ps -ef | awk '/gunicorn/ && !/awk/{print $2}' | xargs kill -9
    26. fi
    27. }
    28. case $1 in
    29. start )
    30. echo "启动Superset"
    31. superset_start
    32. ;;
    33. stop )
    34. echo "停止Superset"
    35. superset_stop
    36. ;;
    37. restart )
    38. echo "重启Superset"
    39. superset_stop
    40. superset_start
    41. ;;
    42. status )
    43. superset_status >/dev/null 2>&1
    44. if [[ $? -eq 0 ]]; then
    45. echo "superset未在运行"
    46. else
    47. echo "superset正在运行"
    48. fi
    49. esac

  • 相关阅读:
    线程并发安全问题解决方案
    在 HBuilderX 中使用 tailwindcss
    一篇搞懂进阶集合使用技巧
    记录配置打印机遇到的三个问题
    机器学习——聚类算法
    【微服务】如何利用Nacos Config实现服务配置?
    linux-守护进程daemon
    spring boot 自定redis缓存注解
    垃圾分类热词获取易语言代码
    k8s 1.28安装
  • 原文地址:https://blog.csdn.net/weixin_63816398/article/details/126455649