Apache Superset是一个开源的、现代的、轻量级BI分析工具,能够对接多种数据源、拥有丰富的图表展示形式、支持自定义仪表盘,且拥有友好的用户界面,十分易用。
- [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
-
-
[atguigu@hadoop102 ~]$ conda create --name superset python=3.7
conda环境管理常用命令
创建环境:conda create -n env_name
查看所有环境:conda info --envs
删除一个环境:conda remove -n env_name --all
[atguigu@hadoop102 ~]$ conda activate superset
4)执行python命令查看python版本
[atguigu@hadoop102 ~]$ python
安装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‘
[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
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.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