superset day01

  • 目录

    安装supeset

    1. 部署python环境

    (1)安装Python3环境准备的包

    (2)上传python安装包Python-3.6.6.tgz 至linux上

    (3)编译安装python3.x

    (4)安装python3的virtualenv并建⽴superset的env

    (5)安装superset需要的安装包

    2 Superset部署

    (1)安装Superset

    (2)安装Mysql数据包

    (3)创建数据库

    (4)修改superset元数据库

    (5)初始化Supetset数据库(Supetset是一个web应用,自带数据库,需要初始化)

     (superset) [root@bigdata15  src]$ superset db upgrade

    (6)创建管理员用户

    (7)Superset初始化

    3. 启动Superset


  • superset 数据可视化 
  • 1.官网地址
        superset.apache.org 
  • 安装supeset

    • ①python 
    • ②supeset   (不要和mysql 服务部署在一起)
      • 完全分布式
        superset day01_第1张图片
      • 单点分布式
        superset day01_第2张图片
  • 1. 部署python环境

    • (1)安装Python3环境准备的包

      • [root@hadoop15  ] yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

      • 安装EPEL源并安装superset必备的包:

        • [root@hadoop15 ~] yum install epel-release #安装epel源

        • [root@hadoop15 ~ ] yum install mysql-devel #安装MySQL开发包,属于pymysqlclient依赖

        • [root@hadoop15 ~]yum install gcc gcc-c++ libffi-devel python-devel python-pip python-wheel openssl-devel cyrus-sasl-devel openldap-devel

    • (2)上传python安装包Python-3.6.6.tgz 至linux上

      • [root@bigdata15 ~]# cd /usr/local/src

      • 上传Python-3.6.6.tgz

      • [root@bigdata15 src] # tar -xf ./Python-3.6.6.tgz

    • (3)编译安装python3.x

      • [root@bigdata15 src] # cd Python-3.6.6.tgz

      • [root@bigdata15 Python-3.6.6.tgz]# ./configure

      • [root@bigdata15 Python-3.6.6.tgz]# make && make install

    • (4)安装python3的virtualenv并建⽴superset的env

      • [root@bigdata15 Python-3.6.6.tgz]#pip3 install --upgrade pip -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

      • [root@bigdata15 Python-3.6.6.tgz]#pip3 install virtualenv -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

      • [root@bigdata15 Python-3.6.6.tgz]#pip3 install --upgrade setuptools -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

      • 建⽴superset的env&激活:

        • [root@bigdata15 Python-3.6.6.tgz]# cd ..
        • [root@bigdata15 src]# python3 -m venv superset-py3
        • [root@bigdata15 src]# source superset-py3/bin/activate #激活superset的venv
          superset day01_第3张图片
    • (5)安装superset需要的安装包

      • 1. 创建requirement.txt:[root@bigdata15 src]# vim requirement.txt
      • 2. requirement.txt文件添加
      • //requirement.txt内容
        alembic==1.3.2            # via flask-migrate
        amqp==2.5.2               # via kombu
        apispec[yaml]==1.3.3      # via flask-appbuilder
        attrs==19.3.0             # via jsonschema
        babel==2.8.0              # via flask-babel
        backoff==1.10.0           # via apache-superset (setup.py)
        billiard==3.6.3.0         # via celery
        bleach==3.1.0             # via apache-superset (setup.py)     ---
        celery==4.4.1             # via apache-superset (setup.py)
        cffi==1.13.2              # via cryptography
        click==7.1.1              # via apache-superset (setup.py), flask, flask-appbuilder
        colorama==0.4.3           # via apache-superset (setup.py), flask-appbuilder
        contextlib2==0.6.0.post1  # via apache-superset (setup.py)
        croniter==0.3.31          # via apache-superset (setup.py)
        cryptography==2.8         # via apache-superset (setup.py)
        decorator==4.4.1          # via retry
        defusedxml==0.6.0         # via python3-openid
        flask-appbuilder==2.2.4   # via apache-superset (setup.py)
        flask-babel==1.0.0        # via flask-appbuilder
        flask-caching==1.8.0      # via apache-superset (setup.py)
        flask-compress==1.4.0     # via apache-superset (setup.py)
        flask-jwt-extended==3.24.1  # via flask-appbuilder
        flask-login==0.4.1        # via flask-appbuilder
        flask-migrate==2.5.2      # via apache-superset (setup.py)
        flask-openid==1.2.5       # via flask-appbuilder
        flask-sqlalchemy==2.4.1   # via flask-appbuilder, flask-migrate
        flask-talisman==0.7.0     # via apache-superset (setup.py)
        flask-wtf==0.14.2         # via apache-superset (setup.py), flask-appbuilder
        flask==1.1.1              # via apache-superset (setup.py), flask-appbuilder, flask-babel, flask-caching, flask-compress, flask-jwt-extended, flask-login, flask-migrate, flask-openid, flask-sqlalchemy, flask-wtf
        geographiclib==1.50       # via geopy
        geopy==1.20.0             # via apache-superset (setup.py)
        gunicorn==20.0.4          # via apache-superset (setup.py)
        humanize==0.5.1           # via apache-superset (setup.py)
        importlib-metadata==1.4.0  # via jsonschema, kombu
        isodate==0.6.0            # via apache-superset (setup.py)
        itsdangerous==1.1.0       # via flask
        jinja2==2.10.3            # via flask, flask-babel
        jsonschema==3.2.0         # via flask-appbuilder
        kombu==4.6.8              # via celery
        mako==1.1.1               # via alembic
        markdown==3.1.1           # via apache-superset (setup.py)
        markupsafe==1.1.1         # via jinja2, mako
        marshmallow-enum==1.5.1   # via flask-appbuilder
        marshmallow-sqlalchemy==0.21.0  # via flask-appbuilder
        marshmallow==2.19.5       # via flask-appbuilder, marshmallow-enum, marshmallow-sqlalchemy
        more-itertools==8.1.0     # via zipp
        msgpack==0.6.2            # via apache-superset (setup.py)
        numpy==1.18.1             # via pandas, pyarrow
        pandas==0.25.3            # via apache-superset (setup.py)
        parsedatetime==2.5        # via apache-superset (setup.py)
        pathlib2==2.3.5           # via apache-superset (setup.py)
        polyline==1.4.0           # via apache-superset (setup.py)
        prison==0.1.2             # via flask-appbuilder
        py==1.8.1                 # via retry
        pyarrow==0.16.0           # via apache-superset (setup.py)
        pycparser==2.19           # via cffi
        pyjwt==1.7.1              # via flask-appbuilder, flask-jwt-extended
        python-dateutil==2.8.1    # via alembic, apache-superset (setup.py), croniter, flask-appbuilder, pandas
        python-dotenv==0.10.5     # via apache-superset (setup.py)
        python-editor==1.0.4      # via alembic
        python-geohash==0.8.5     # via apache-superset (setup.py)
        python3-openid==3.1.0     # via flask-openid
        pytz==2019.3              # via babel, celery, flask-babel, pandas
        pyyaml==5.3               # via apache-superset (setup.py), apispec
        retry==0.9.2              # via apache-superset (setup.py)
        selenium==3.141.0         # via apache-superset (setup.py)
        simplejson==3.17.0        # via apache-superset (setup.py)
        six==1.14.0               # via bleach, cryptography, flask-jwt-extended, flask-talisman, isodate, jsonschema, pathlib2, polyline, prison, pyarrow, pyrsistent, python-dateutil, sqlalchemy-utils, wtforms-json
        sqlalchemy-utils==0.36.1  # via apache-superset (setup.py), flask-appbuilder
        sqlalchemy==1.3.12        # via alembic, apache-superset (setup.py), flask-sqlalchemy, marshmallow-sqlalchemy, sqlalchemy-utils
        sqlparse==0.3.0           # via apache-superset (setup.py)
        urllib3==1.25.8           # via selenium
        vine==1.3.0               # via amqp, celery
        webencodings==0.5.1       # via bleach
        werkzeug==0.16.0          # via flask, flask-jwt-extended
        wtforms-json==0.3.3       # via apache-superset (setup.py)
        wtforms==2.2.1            # via flask-wtf, wtforms-json
        zipp==2.0.0               # via importlib-metadata
      • 3.执行
        (superset-py3) [root@bigdata15 src]# pip3 install -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com -r requirement.txt
    • Superset部署

      • (1)安装Superset

        • (superset-py3) [root@bigdata15 src]# pip3 install apache-superset==0.37.1  -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

      • (2)安装Mysql数据包

        • (superset-py3) [root@bigdata15 src]# pip3 install sqlalchemy==1.3.24 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

        • (superset-py3) [root@bigdata15 src]# pip3 install mysqlclient -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

        • (superset-py3) [root@bigdata15 src]# pip3 install "pymssql<3.0" -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

      • (3)创建数据库

                在数据库中建2表
        • CREATE DATABASE `superset` /*!40100 DEFAULT CHARACTER SET utf8 */;
          superset day01_第4张图片

      • (4)修改superset元数据库

        • (superset-py3) [root@bigdata15 src]# vim superset-py3/lib/python3.6/site-packages/superset/config.py

          • 修改SQLALCHEMY_DATABASE_URI 
            在config.py查找SQLALCHEMY_DATABASE_URI  ::/SQLALCHEMY_DATABASE_URI
            'mysql://root:123456@bigdata13/superset?charset=utf8'     
            用bigdata13因为mysql部署在中

      • (5)初始化Supetset数据库(Supetset是一个web应用,自带数据库,需要初始化)

        •  (superset) [root@bigdata15  src]$ superset db upgrade

      • (6)创建管理员用户

        • (superset) [root@bigdata15  src]$ export FLASK_APP=superset

        • (superset) [root@bigdata15  src]$ flask fab create-admin
          superset day01_第5张图片

      • (7)Superset初始化

        •  (superset) [root@bigdata15  src]$ superset init

    • 3. 启动Superset

      • 1.(superset) [root@bigdata15 src]$  superset run -h bigdata15 -p 8889
      • 2)web登录

        • 访问http://bigdata15:8889/
          superset day01_第6张图片
        • 1.databases
          superset day01_第7张图片
        • 2. 添加 Add
        • 3.此操作可以在bigdata15机器连接到bigdata13机器
          superset day01_第8张图片
        • 4.保存后
          superset day01_第9张图片
        • 5.使用
          superset day01_第10张图片
    • (3)superset启停脚本
  •  4. 重启后启动命令

    • [root@bigdata15 hadoop]# cd /usr/local/src
    • [root@bigdata15 src]# source superset-py3/bin/activate
    • (superset-py3) [root@bigdata15 src]#  superset run -h bigdata15 -p 8889

你可能感兴趣的:(superset,linux,运维,centos)