Apache-Superset详细安装-Apache第一大开源项目
2026/5/7 10:14:58 网站建设 项目流程

你只需要按照流程来,肯定不会出错,我经历的坑全部都在里面
centos7安装---superset

#wget拉取miniconda3安装包(自带python12环境)superset官网安装环境需要python12 wget https://repo.anaconda.com/miniconda/Miniconda3-py312_24.1.2-0-Linux-x86_64.sh; #执行bash [root@hjx-centos7 ~]# bash Miniconda3-py312_24.1.2-0-Linux-x86_64.sh #加载环境变量 source ~/.bashrc #配置镜像 [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 #关闭默认conda环境 [atguigu@hadoop102 lib]$ conda config --set auto_activate_base false #安装superset环境python [root@hjx-centos7 ~]# conda create --name superset python=3.12 #进入环境 [root@hjx-centos7 ~]# conda activate superset (superset) [superset@hjx-el7-superset ~]$ conda install psycopg2 #退出环境 (superset) [root@hjx-centos7 ~]# conda deactivate #安装superset依赖 (superset) [root@hjx-centos7 ~]# sudo yum install gcc gcc-c++ libffi-devel python-devel python-pip python-wheel openssl-devel cyrus-sasl-devel openldap-devel python3-devel #更新setuptools和pip (superset) [root@hjx-centos7 ~]# pip install --upgrade setuptools pip -i https://pypi.tuna.tsinghua.edu.cn/simple/ --trusted-host pypi.tuna.tsinghua.edu.cn #安装依赖(由于安装superset编译一直卡住,导致需要直接安装包然后在进行安装superset) (superset) [superset@centos4 ~]$ pip install apsw>=3.43.2.0 -i https://mirrors.aliyun.com/pypi/simple/ --only-binary=:all: --trusted-host mirrors.aliyun.com #安装Superset (superset) [root@hjx-centos7 ~]# pip install apache-superset -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

设置生产元数据数据库(superset只支持Mysql、postgresql具体版本请查看superset官网)

(superset) [root@hjx-centos7 bin]# conda install mysqlclient (superset) [superset@hjx-el7-superset ~]$ conda install pymysql (superset) [superset@hjx-el7-superset bin]$ conda install -c conda-forge mysql-client (superset) [root@hjx-rocky8-Superset superset]# vim /root/miniconda3/envs/superset/lib/python3.12/site-packages/superset/config.py #添加一下内容 SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://superset:superset@10.197.165.171:3306/superset?charset=utf8mb4' #Mysql数据库需要操作 create database superset; SET GLOBAL validate_password.check_user_name = OFF; -- 设置最低策略级别 SET GLOBAL validate_password.policy = 0; -- 设置最短密码长度 SET GLOBAL validate_password.length = 4; -- 取消大小写混合要求 SET GLOBAL validate_password.mixed_case_count = 0; -- 取消数字要求 SET GLOBAL validate_password.number_count = 0; -- 取消特殊字符要求 SET GLOBAL validate_password.special_char_count = 0; create user 'superset'@'%' IDENTIFIED WITH mysql_native_password BY 'superset'; grant all on *.* to 'superset'@'%';

初始化Superset数据库

(superset) [superset@hjx-el7-superset ~]$ mkdir -p ./superset/logs (superset) [superset@centos4 ~]$ openssl rand -base64 42 6eZBllyXhwb5GKDk9K1CGNwymJY54ViNQgNU6X0n2KfxjCoTBfLnsUi2 cd superset; #增加如下内容 vi ./superset_config.py SECRET_KEY = "66eZBllyXhwb5GKDk9K1CGNwymJY54ViNQgNU6X0n2KfxjCoTBfLnsUi2" vi ~/.bashrc export SUPERSET_CONFIG_PATH="/home/superset/superset/superset_config.py" (superset) [atguigu@hadoop102 ~]$ superset db upgrade #如果SECRET_KEY报错,执行以下操作 export SUPERSET_SECRET_KEY="oh-so-secret"; #创建管理员用户 (superset) [atguigu@hadoop102 ~]$ export FLASK_APP=superset (superset) [atguigu@hadoop102 ~]$ superset fab create-admin ​ #Superset初始化 (superset) [atguigu@hadoop102 ~]$ superset init #安装gunicorn (superset) [root@hjx-centos7 ~]# pip install gunicorn -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com #启动Superset (superset) [root@hjx-centos7 ~]# gunicorn --workers 5 --timeout 120 --bind 10.197.165.117:8100 --daemon --access-logfile /root/superset/logs/access.log --error-logfile /root/superset/logs/error.log "superset.app:create_app()" #关闭superset (superset) [root@hjx-centos7 superset]# ps -ef | awk '/superset/ && !/awk/{print $2}' | xargs kill -9 #配置汉化包 (superset) [root@hjx-centos7 superset]# vim superset_config.py (superset) [root@hjx-centos7 superset]# cat superset_config.py SECRET_KEY = "rqqmcnic5/GsCEgvA982tLwe1s0Yx/JTLoSfVkRR5tr5u9BhBpPHWt/c" LANGUAGES = { "zh": {"flag": "cn", "name": "简体中文"}, "en": {"flag": "us", "name": "English"}, } #生效环境变量,重启superset (superset) [root@hjx-centos7 superset]# source ~/.bashrc

配置superset启停脚本

cat >> ./superset.sh << 'EOF' #!/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 10.197.165.117:8100 --daemon --access-logfile /home/superset/superset/logs/access.log --error-logfile /home/superset/superset/logs/error.log "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 EOF

superset连接oracle数据库

#安装依赖 (superset) [root@hjx-centos7 ~]# conda install oracledb (superset) [root@hjx-centos7 superset]# conda install cx_Oracle #安装oracle install Clinet (superset) [root@hjx-centos7 superset]# yum install perl-DBD-Pg perl perl-devel perl-DBI perl-CPAN bzip2 perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker wget https://download.oracle.com/otn_software/linux/instantclient/219000/oracle-instantclient-basic-21.9.0.0.0-1.x86_64.rpm wget https://download.oracle.com/otn_software/linux/instantclient/219000/oracle-instantclient-devel-21.9.0.0.0-1.x86_64.rpm wget https://download.oracle.com/otn_software/linux/instantclient/219000/oracle-instantclient-sqlplus-21.9.0.0.0-1.x86_64.rpm sudo rpm -ivh oracle-instantclient-*.rpm cat >>/etc/profile <<'EOF' export ORACLE_HOME=/usr/lib/oracle/21/client64/lib export LD_LIBRARY_PATH=$ORACLE_HOME export PATH=$PATH:$ORACLE_HOME EOF . /etc/profile #连接信息如下 oracle+cx_oracle://sys:oracle@10.197.165.184:1521/ORCL?mode=sysdba

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询