# yum install -y wget
# yum install -y gcc* zlib* openssl* sqlite* mysql-devel python-devel
# cd /opt/
# mkdir python
# cd python/
# wget https://www.python.org/ftp/python/3.6.11/Python-3.6.11.tgz
# tar -xf *.tgz
# cd Python-3.6.11
# ./configure --with-ssl
# make && make install
# cd /usr/local/bin
# pip3 install virtualenv
# python3 -m venv venv
# . venv/bin/activate
# pip install --upgrade setuptools pip
# pip install apache-superset 或 # pip install apache-superset -i https://pypi.douban.com/simple
4.配置(可选)
配置superset:
# vi /usr/local/bin/venv/lib/python3.6/site-packages/superset/config.py
1.配置缓存
# pip install redis CACHE_CONFIG: CacheConfig = {"CACHE_TYPE": "null"} 改为 CACHE_CONFIG = { 'CACHE_TYPE': 'redis', 'CACHE_DEFAULT_TIMEOUT': 60 * 60 * 24, # 1 day default (in secs) 'CACHE_KEY_PREFIX': 'superset_results', 'CACHE_REDIS_URL': 'redis://localhost:6379/0', } 或者 CACHE_CONFIG: CacheConfig = {"CACHE_TYPE": "simple"} TABLE_NAMES_CACHE_CONFIG: CacheConfig = {"CACHE_TYPE": "simple"}
上传文件(必须):
# cd /usr/local/bin/venv/lib/python3.6/site-packages
# rz
_bz2.cpython-36m-x86_64-linux-gnu.so
链接: https://pan.baidu.com/s/1vC4hPyfdN3J15z3g8XCFoA
提取码: 7rt1
修改端口号:
# vi /usr/local/bin/venv/lib/python3.6/site-packages/flask/cli.py
- 改为:
@click.command("run", short_help="Run a development server.")
@click.option("--host", "-h", default="192.168.75.134", help="The interface to bind to.")
@click.option("--port", "-p", default=8088, help="The port to bind to.")
- 初始化数据库
# superset db upgrade
- 创建用户
# superset fab create-admin
- 加载一些数据来处理
# superset load_examples
- 创建默认角色和权限
# superset init
-
# superset run -p 8088 --with-threads --reload --debugger 或 nohup superset run -h 192.168.73.134 -p 8088 &
# deactivate (退出环境)
# cd /usr/local/bin
# . venv/bin/activate
# nohup superset run &
# deactivate
# ps -ef |grep superset
# kill -9 ...
# pip install mysqlclient
# pip install pymysql
SQLAlchemy URI : mysql+pymysql://root:[email protected]:3306/clickhouse
# pip install sqlalchemy-clickhouse
SQLAlchemy URI : clickhouse://default:[email protected]:8123/default
# pip install elasticsearch-dbapi
SQLAlchemy URI : elasticsearch+http://elastic:[email protected]:9200/
ERROR:superset.views.core:Unexpected error No module named ‘pymysql’
# pip install pymysql
其实用户名和密码是正确的但是就是显示失败
参考连接: https://blog.csdn.net/m0_47467356/article/details/105844252
# pip3 install sqlalchemy-clickhouse (通过再次下载确定配置文件位置)
# vi /usr/local/bin/venv/lib/python3.6/site-packages/sqlalchemy_clickhouse/connector.py
1、注释掉sqlalchemy_clickhouse/connector.py中的代码Database._send = _send
,
as it will use none auth to check _is_existing_database in infi/clickhouse_orm/database.py
2、或者将更改sqlalchemy_clickhouse/connector.py中的_send函数由:
def _send(self, data, settings=None, stream=False):
if PY3 and isinstance(data, string_types):
data = data.encode('utf-8')
params = self._build_params(settings)
r = requests.post(self.db_url, params=params, data=data, stream=stream)
if r.status_code != 200:
raise Exception(r.text)
return r
替换为:
def _send(self, data, settings=None, stream=False):
if PY3 and isinstance(data, string_types):
data = data.encode('utf-8')
params = self._build_params(settings)
# r = requests.post(self.db_url, params=params, data=data, stream=stream)
r = self.request_session.post(
self.db_url, params=params, data=data, stream=stream, timeout=self.timeout)
if r.status_code != 200:
raise Exception(r.text)
return r
进入vi /usr/local/bin/venv/lib/python3.6/site-packages/superset/config.py
CACHE_CONFIG: CacheConfig = {"CACHE_TYPE": "simple"}
TABLE_NAMES_CACHE_CONFIG: CacheConfig = {"CACHE_TYPE": "simple"}
centOS7,默认的是python2.7版本,要换3.x会出现yum不能使用的情况,以下为修改的方式:
换了python要改两个地方
1,vi /usr/libexec/urlgrabber-ext-down
2.vi /usr/bin/yum
改为#! /usr/bin/python2.7