>>技术开发:轻量级BI工具Superset

2023-10-10 14:07:40 浏览数 (2)

轻量级BI工具Superset

Mac OS of Superset

前言 Superset是一款可视化的BI工具,主要依赖于python环境。 pip 是一个Python包安装与管理工具。

操作步骤
1、首先查看是否存在pip

pip --version

-bash: pip: command not found

2、安装pip命令

Mac操作系统自带了python,默认的是2.7,我们不使用自带,安装新版本的

Python3 的安装方式

curl https://bootstrap.pypa.io/get-pip.py | python3

% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1825k 100 1825k 0 0 16620 0 0:01:52 0:01:52 --:–:-- 12362 Collecting pip Downloading pip-20.1.1-py2.py3-none-any.whl (1.5 MB) |████████████████████████████████| 1.5 MB 14 kB/s Installing collected packages: pip Attempting uninstall: pip Found existing installation: pip 20.0.2 Uninstalling pip-20.0.2: Successfully uninstalled pip-20.0.2 Successfully installed pip-20.1.1

出现 successfully,则说明pip已经安装成功

3、安装setuptools工具

pip install --upgrade setuptools pip

Collecting setuptools Downloading setuptools-49.2.0-py3-none-any.whl (789 kB) |████████████████████████████████| 789 kB 10 kB/s Requirement already up-to-date: pip in /usr/local/lib/python3.7/site-packages (20.1.1) Installing collected packages: setuptools Attempting uninstall: setuptools Found existing installation: setuptools 46.0.0 Uninstalling setuptools-46.0.0: Successfully uninstalled setuptools-46.0.0 Successfully installed setuptools-49.2.0

出现successfully,则说明setuptools已经安装成功

4、添加支持以及初始化

安装superset,这一步骤执行过程很慢,很不建议使用命令行模式来执行

pip install apache-superset

Collecting apache-superset Using cached apache-superset-0.36.0.tar.gz (47.1 MB) Collecting backoff>=1.8.0 Using cached backoff-1.10.0-py2.py3-none-any.whl (31 kB) Collecting bleach<4.0.0,>=3.0.2 Using cached bleach-3.1.5-py2.py3-none-any.whl (151 kB) Collecting celery!=4.4.1,<5.0.0,>=4.3.0 Using cached celery-4.4.6-py2.py3-none-any.whl (426 kB) Collecting click<8 Using cached click-7.1.2-py2.py3-none-any.whl (82 kB) Collecting colorama Using cached colorama-0.4.3-py2.py3-none-any.whl (15 kB) Collecting contextlib2 Using cached contextlib2-0.6.0.post1-py2.py3-none-any.whl (9.8 kB) Collecting croniter>=0.3.28 Using cached croniter-0.3.34-py2.py3-none-any.whl (19 kB) Collecting cryptography>=2.4.2 Using cached cryptography-3.0-cp35-abi3-macosx_10_10_x86_64.whl (1.8 MB) Collecting flask<2.0.0,>=1.1.0 Using cached Flask-1.1.2-py2.py3-none-any.whl (94 kB) Collecting flask-appbuilder<2.4.0,>=2.3.1 Using cached Flask_AppBuilder-2.3.4-py3-none-any.whl (1.7 MB) Collecting flask-caching Using cached Flask_Caching-1.9.0-py2.py3-none-any.whl (33 kB) Collecting flask-compress Using cached Flask-Compress-1.5.0.tar.gz (6.5 kB) Collecting flask-talisman Using cached flask_talisman-0.7.0-py2.py3-none-any.whl (12 kB) Collecting flask-migrate Using cached Flask_Migrate-2.5.3-py2.py3-none-any.whl (13 kB) Collecting flask-wtf Using cached Flask_WTF-0.14.3-py2.py3-none-any.whl (13 kB) Collecting geopy Using cached geopy-2.0.0-py3-none-any.whl (111 kB) Collecting gunicorn<20.1,>=20.0.2 Using cached gunicorn-20.0.4-py2.py3-none-any.whl (77 kB) Collecting humanize Using cached humanize-2.5.0-py3-none-any.whl (65 kB) Collecting isodate Using cached isodate-0.6.0-py2.py3-none-any.whl (45 kB) Collecting markdown>=3.0 Using cached Markdown-3.2.2-py3-none-any.whl (88 kB) Collecting msgpack<0.7.0,>=0.6.1 Using cached msgpack-0.6.2-cp37-cp37m-macosx_10_14_x86_64.whl (79 kB) Collecting pandas<1.0,>=0.25.3 Using cached pandas-0.25.3-cp37-cp37m-macosx_10_9_x86_64.whl (10.2 MB) Collecting parsedatetime Using cached parsedatetime-2.6-py3-none-any.whl (42 kB) Collecting pathlib2 Using cached pathlib2-2.3.5-py2.py3-none-any.whl (18 kB) Collecting polyline Using cached polyline-1.4.0-py2.py3-none-any.whl (4.4 kB) Collecting python-dateutil Using cached python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB) Collecting python-dotenv Using cached python_dotenv-0.14.0-py2.py3-none-any.whl (17 kB) Collecting python-geohash Using cached python-geohash-0.8.5.tar.gz (17 kB) Collecting pyarrow<0.17.0,>=0.16.0 Using cached pyarrow-0.16.0-cp37-cp37m-macosx_10_9_intel.whl (40.5 MB) Collecting pyyaml>=5.1 Using cached PyYAML-5.3.1.tar.gz (269 kB) Collecting retry>=0.9.2 Using cached retry-0.9.2-py2.py3-none-any.whl (8.0 kB) Collecting selenium>=3.141.0 Using cached selenium-3.141.0-py2.py3-none-any.whl (904 kB) Collecting simplejson>=3.15.0 Using cached simplejson-3.17.2-cp37-cp37m-macosx_10_14_x86_64.whl (73 kB) Collecting sqlalchemy<2.0,>=1.3.5 Using cached SQLAlchemy-1.3.18-cp37-cp37m-macosx_10_14_x86_64.whl (1.2 MB) Collecting sqlalchemy-utils>=0.33.2 Using cached SQLAlchemy-Utils-0.36.8.tar.gz (138 kB) Collecting sqlparse<0.4,>=0.3.0 Using cached sqlparse-0.3.1-py2.py3-none-any.whl (40 kB) Collecting wtforms-json Using cached WTForms-JSON-0.3.3.tar.gz (11 kB) Collecting webencodings Using cached webencodings-0.5.1-py2.py3-none-any.whl (11 kB) Collecting packaging Using cached packaging-20.4-py2.py3-none-any.whl (37 kB) Collecting six>=1.9.0 Using cached six-1.15.0-py2.py3-none-any.whl (10 kB) Collecting future>=0.18.0 Using cached future-0.18.2.tar.gz (829 kB) Collecting vine==1.3.0 Using cached vine-1.3.0-py2.py3-none-any.whl (14 kB) Collecting kombu<4.7,>=4.6.10 Using cached kombu-4.6.11-py2.py3-none-any.whl (184 kB) Collecting billiard<4.0,>=3.6.3.0 Using cached billiard-3.6.3.0-py3-none-any.whl (89 kB) Collecting pytz>dev Using cached pytz-2020.1-py2.py3-none-any.whl (510 kB) Collecting natsort Using cached natsort-7.0.1-py3-none-any.whl (33 kB) Collecting cffi!=1.11.3,>=1.8 Using cached cffi-1.14.0-cp37-cp37m-macosx_10_9_x86_64.whl (174 kB) Collecting Jinja2>=2.10.1 Using cached Jinja2-2.11.2-py2.py3-none-any.whl (125 kB) Collecting itsdangerous>=0.24 Using cached itsdangerous-1.1.0-py2.py3-none-any.whl (16 kB) Collecting Werkzeug>=0.15 Using cached Werkzeug-1.0.1-py2.py3-none-any.whl (298 kB) Collecting Flask-Babel<2,>=1 Using cached Flask_Babel-1.0.0-py3-none-any.whl (9.5 kB) Collecting PyJWT>=1.7.1 Using cached PyJWT-1.7.1-py2.py3-none-any.whl (18 kB) Collecting email-validator<2,>=1.0.5 Using cached email_validator-1.1.1-py2.py3-none-any.whl (17 kB) Collecting Flask-OpenID<2,>=1.2.5 Using cached Flask-OpenID-1.2.5.tar.gz (43 kB) Collecting prison<1.0.0,>=0.1.3 Using cached prison-0.1.3-py2.py3-none-any.whl (5.8 kB) Collecting jsonschema<4,>=3.0.1 Using cached jsonschema-3.2.0-py2.py3-none-any.whl (56 kB) Collecting marshmallow-sqlalchemy<1,>=0.16.1 Using cached marshmallow_sqlalchemy-0.23.1-py2.py3-none-any.whl (18 kB) Collecting apispec[yaml]<2,>=1.1.1 Using cached apispec-1.3.3-py2.py3-none-any.whl (23 kB) Collecting marshmallow<3.0.0,>=2.18.0 Using cached marshmallow-2.21.0-py2.py3-none-any.whl (50 kB) Collecting marshmallow-enum<2,>=1.4.1 Using cached marshmallow_enum-1.5.1-py2.py3-none-any.whl (4.2 kB) Collecting Flask-Login<0.5,>=0.3 Using cached Flask-Login-0.4.1.tar.gz (14 kB) Collecting Flask-SQLAlchemy<3,>=2.4 Using cached Flask_SQLAlchemy-2.4.4-py2.py3-none-any.whl (17 kB) Collecting Flask-JWT-Extended<4,>=3.18 Using cached Flask-JWT-Extended-3.24.1.tar.gz (31 kB) Collecting brotli Using cached Brotli-1.0.7-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (796 kB) Collecting alembic>=0.7 Using cached alembic-1.4.2.tar.gz (1.1 MB) Installing build dependencies … done Getting requirements to build wheel … done Preparing wheel metadata … done Collecting WTForms Using cached WTForms-2.3.1-py2.py3-none-any.whl (169 kB) Collecting geographiclib<2,>=1.49 Using cached geographiclib-1.50-py3-none-any.whl (38 kB) Requirement already satisfied: setuptools>=3.0 in /usr/local/lib/python3.7/site-packages (from gunicorn<20.1,>=20.0.2->apache-superset) (49.2.0) Collecting importlib-metadata; python_version < “3.8” Using cached importlib_metadata-1.7.0-py2.py3-none-any.whl (31 kB) Collecting numpy>=1.13.3 Using cached numpy-1.19.1-cp37-cp37m-macosx_10_9_x86_64.whl (15.3 MB) Collecting decorator>=3.4.2 Using cached decorator-4.4.2-py2.py3-none-any.whl (9.2 kB) Collecting py<2.0.0,>=1.4.26 Using cached py-1.9.0-py2.py3-none-any.whl (99 kB) Collecting urllib3 Using cached urllib3-1.25.9-py2.py3-none-any.whl (126 kB) Collecting pyparsing>=2.0.2 Using cached pyparsing-2.4.7-py2.py3-none-any.whl (67 kB) Collecting amqp<2.7,>=2.6.0 Using cached amqp-2.6.0-py2.py3-none-any.whl (47 kB) Collecting pycparser Using cached pycparser-2.20-py2.py3-none-any.whl (112 kB) Collecting MarkupSafe>=0.23 Using cached MarkupSafe-1.1.1-cp37-cp37m-macosx_10_6_intel.whl (18 kB) Collecting Babel>=2.3 Downloading Babel-2.8.0-py2.py3-none-any.whl (8.6 MB) |████████████████████████████████| 8.6 MB 11 kB/s Collecting idna>=2.0.0 Using cached idna-2.10-py2.py3-none-any.whl (58 kB) Collecting dnspython>=1.15.0 Using cached dnspython-2.0.0-py3-none-any.whl (208 kB) Collecting python3-openid>=2.0 Using cached python3_openid-3.2.0-py3-none-any.whl (133 kB) Collecting pyrsistent>=0.14.0 Using cached pyrsistent-0.16.0.tar.gz (108 kB) Collecting attrs>=17.4.0 Using cached attrs-19.3.0-py2.py3-none-any.whl (39 kB) Collecting python-editor>=0.3 Downloading python_editor-1.0.4-py3-none-any.whl (4.9 kB) Collecting Mako Downloading Mako-1.1.3-py2.py3-none-any.whl (75 kB) |████████████████████████████████| 75 kB 14 kB/s Collecting zipp>=0.5 Downloading zipp-3.1.0-py3-none-any.whl (4.9 kB) Collecting defusedxml Downloading defusedxml-0.6.0-py2.py3-none-any.whl (23 kB) Building wheels for collected packages: apache-superset, flask-compress, python-geohash, pyyaml, sqlalchemy-utils, wtforms-json, future, Flask-OpenID, Flask-Login, Flask-JWT-Extended, alembic, pyrsistent Building wheel for apache-superset (setup.py) … done Created wheel for apache-superset: filename=apache_superset-0.36.0-py3-none-any.whl size=47783753 sha256=47f68d11744527b36a2c97f8dd15a20c2be1910aa11f7e3c964e357546082dff Stored in directory: HOME/Caches/pip/wheels/8b/41/de/44ceb9b61f69c1935aac2546765d17164d93158e745244e6c1 Building wheel for flask-compress (setup.py) … done Created wheel for flask-compress: filename=Flask_Compress-1.5.0-py3-none-any.whl size=5271 sha256=4191a753faaa5b00126e2da5400eb669f887be94214b94e1fb90f30839273853 Stored in directory: HOME/Caches/pip/wheels/d6/9f/c9/4bf2abf65cceaa8d19423bc34b88443b3b063f167d2082c212 Building wheel for python-geohash (setup.py) … done Created wheel for python-geohash: filename=python_geohash-0.8.5-cp37-cp37m-macosx_10_15_x86_64.whl size=17308 sha256=c9e2d69b2b1c4d533f632c794abe419e256441acb84bb8eeaa95f280d671bbbb Stored in directory: HOME/Caches/pip/wheels/ea/62/7a/e8b943f1d8025cd93a93928a162319e56843301c8c06610ffe Building wheel for pyyaml (setup.py) … done Created wheel for pyyaml: filename=PyYAML-5.3.1-cp37-cp37m-macosx_10_15_x86_64.whl size=153150 sha256=6cd630c88f30bc85939db980ff8349ad02585bae6a3bff79e09d2c3448d621e8 Stored in directory: HOME/Caches/pip/wheels/5e/03/1e/e1e954795d6f35dfc7b637fe2277bff021303bd9570ecea653 Building wheel for sqlalchemy-utils (setup.py) … done Created wheel for sqlalchemy-utils: filename=SQLAlchemy_Utils-0.36.8-py2.py3-none-any.whl size=93221 sha256=205a13f19cb27c6d824f668288af59d34a810d1b718641c932b114369d4b17b0 Stored in directory: HOME/Caches/pip/wheels/29/c3/6b/495f824c202b91e5dc231e802afa062910f229ad2131588a96 Building wheel for wtforms-json (setup.py) … done Created wheel for wtforms-json: filename=WTForms_JSON-0.3.3-py3-none-any.whl size=4731 sha256=023cb648a9e4392d16ba3f131c9339d148f49ccd8369c97d038f601ddc2877bf Stored in directory: HOME/Caches/pip/wheels/e2/33/56/363cdd3ef8148f9bc16803de6ff33be8196fb1613af8905ab3 Building wheel for future (setup.py) … done Created wheel for future: filename=future-0.18.2-py3-none-any.whl size=491058 sha256=40f28c9a958ddb8054ab1806534d1b212c6f55920a3a655273d366825af49d70 Stored in directory: HOME/Caches/pip/wheels/56/b0/fe/4410d17b32f1f0c3cf54cdfb2bc04d7b4b8f4ae377e2229ba0 Building wheel for Flask-OpenID (setup.py) … done Created wheel for Flask-OpenID: filename=Flask_OpenID-1.2.5-py3-none-any.whl size=9120 sha256=204499cb2138e97eae55897503e2ce59d438744dbabf3e48d09cc595f96ae51b Stored in directory: HOME/Caches/pip/wheels/65/7b/bb/26e83746ed4bf0e29b5fdbcfe04a65c1f9b2d007dafebd35a3 Building wheel for Flask-Login (setup.py) … done Created wheel for Flask-Login: filename=Flask_Login-0.4.1-py2.py3-none-any.whl size=15935 sha256=8bcb2760f1ace30ace1c511c335943fea4c8436e0b12b94aa50723342fe70d60 Stored in directory: HOME/Caches/pip/wheels/6b/b8/33/1da5a5d39e093a68d81848aa44fd70e3cd0193e6f2d5641052 Building wheel for Flask-JWT-Extended (setup.py) … done Created wheel for Flask-JWT-Extended: filename=Flask_JWT_Extended-3.24.1-py2.py3-none-any.whl size=21513 sha256=8ae46c6f88a5296c42c762fe967dc12615cbf352d731e8d774ee3a5c3afd3413 Stored in directory: HOME/Caches/pip/wheels/5d/e6/e4/0327f91fde6e288d17757185e957e91e89d06bd2dd6dd365b8 Building wheel for alembic (PEP 517) … done Created wheel for alembic: filename=alembic-1.4.2-py2.py3-none-any.whl size=159543 sha256=97ee1b9ef7327e82a98b8f5e457aabe003cfa13988caeaae5a5c8eaf96ef88ae Stored in directory: HOME/Caches/pip/wheels/4e/b5/00/f93fe1c90b3d501774e91e2e99987f49d16019e40e4bd3afc3 Building wheel for pyrsistent (setup.py) … done Created wheel for pyrsistent: filename=pyrsistent-0.16.0-cp37-cp37m-macosx_10_15_x86_64.whl size=68988 sha256=15356c0a39d106cb705ed1ff5cddfca270dca7619cd7c2ae3e8209da3c44c8c7 Stored in directory: HOME/Caches/pip/wheels/22/52/11/f0920f95c23ed7d2d0b05f2b7b2f4509e87a20cfe8ea43d987 Successfully built apache-superset flask-compress python-geohash pyyaml sqlalchemy-utils wtforms-json future Flask-OpenID Flask-Login Flask-JWT-Extended alembic pyrsistent Installing collected packages: backoff, webencodings, six, pyparsing, packaging, bleach, future, vine, zipp, importlib-metadata, amqp, kombu, billiard, pytz, celery, click, colorama, contextlib2, python-dateutil, natsort, croniter, pycparser, cffi, cryptography, MarkupSafe, Jinja2, itsdangerous, Werkzeug, flask, Babel, Flask-Babel, PyJWT, idna, dnspython, email-validator, sqlalchemy, sqlalchemy-utils, defusedxml, python3-openid, Flask-OpenID, prison, pyrsistent, attrs, jsonschema, marshmallow, marshmallow-sqlalchemy, WTForms, flask-wtf, pyyaml, apispec, marshmallow-enum, Flask-Login, Flask-SQLAlchemy, Flask-JWT-Extended, flask-appbuilder, flask-caching, brotli, flask-compress, flask-talisman, python-editor, Mako, alembic, flask-migrate, geographiclib, geopy, gunicorn, humanize, isodate, markdown, msgpack, numpy, pandas, parsedatetime, pathlib2, polyline, python-dotenv, python-geohash, pyarrow, decorator, py, retry, urllib3, selenium, simplejson, sqlparse, wtforms-json, apache-superset Successfully installed Babel-2.8.0 Flask-Babel-1.0.0 Flask-JWT-Extended-3.24.1 Flask-Login-0.4.1 Flask-OpenID-1.2.5 Flask-SQLAlchemy-2.4.4 Jinja2-2.11.2 Mako-1.1.3 MarkupSafe-1.1.1 PyJWT-1.7.1 WTForms-2.3.1 Werkzeug-1.0.1 alembic-1.4.2 amqp-2.6.0 apache-superset-0.36.0 apispec-1.3.3 attrs-19.3.0 backoff-1.10.0 billiard-3.6.3.0 bleach-3.1.5 brotli-1.0.7 celery-4.4.6 cffi-1.14.0 click-7.1.2 colorama-0.4.3 contextlib2-0.6.0.post1 croniter-0.3.34 cryptography-3.0 decorator-4.4.2 defusedxml-0.6.0 dnspython-2.0.0 email-validator-1.1.1 flask-1.1.2 flask-appbuilder-2.3.4 flask-caching-1.9.0 flask-compress-1.5.0 flask-migrate-2.5.3 flask-talisman-0.7.0 flask-wtf-0.14.3 future-0.18.2 geographiclib-1.50 geopy-2.0.0 gunicorn-20.0.4 humanize-2.5.0 idna-2.10 importlib-metadata-1.7.0 isodate-0.6.0 itsdangerous-1.1.0 jsonschema-3.2.0 kombu-4.6.11 markdown-3.2.2 marshmallow-2.21.0 marshmallow-enum-1.5.1 marshmallow-sqlalchemy-0.23.1 msgpack-0.6.2 natsort-7.0.1 numpy-1.19.1 packaging-20.4 pandas-0.25.3 parsedatetime-2.6 pathlib2-2.3.5 polyline-1.4.0 prison-0.1.3 py-1.9.0 pyarrow-0.16.0 pycparser-2.20 pyparsing-2.4.7 pyrsistent-0.16.0 python-dateutil-2.8.1 python-dotenv-0.14.0 python-editor-1.0.4 python-geohash-0.8.5 python3-openid-3.2.0 pytz-2020.1 pyyaml-5.3.1 retry-0.9.2 selenium-3.141.0 simplejson-3.17.2 six-1.15.0 sqlalchemy-1.3.18 sqlalchemy-utils-0.36.8 sqlparse-0.3.1 urllib3-1.25.9 vine-1.3.0 webencodings-0.5.1 wtforms-json-0.3.3 zipp-3.1.0

备注: 此处可以使用豆瓣镜像,速度没法说,执行命令,验证方式同上

pip install apache-superset -i https://pypi.douban.com/simple

执行安装superset

pip install superset

备注: 此处可以使用豆瓣镜像,速度没法说,执行命令,验证方式同上

pip install superset -i https://pypi.douban.com/simple

5、支持mysql

brew install mysqlclient brew install mysql-connector-c pip install mysqlclient pip3 install mysqlclient

Collecting mysqlclient Using cached mysqlclient-2.0.1.tar.gz (87 kB) Building wheels for collected packages: mysqlclient Building wheel for mysqlclient (setup.py) … done Created wheel for mysqlclient: filename=mysqlclient-2.0.1-cp37-cp37m-macosx_10_15_x86_64.whl size=55758 sha256=f882c605ede9d2bc1b3654f81349cc56f7278e7e8bbb302abea6c032de642c86 Stored in directory: HOME/Caches/pip/wheels/f0/33/cd/bfa1399be3b3b6fc77eb6a53e446eed887b1a35c90d0e3cbf2 Successfully built mysqlclient Installing collected packages: mysqlclient Successfully installed mysqlclient-2.0.1

出现 successfully,则说明pip mysqlclient已经安装成功

我笔记本安装的时候提示我mysql_config not found,我这边一直没有安装上去,查看了配置文件是有的,只是没有设定软连接,设置一下,然后再次执行pip install mysqlclient即可。

ln -s /usr/local/mysql/bin/mysql_config /usr/local/bin/mysql_config

6、初始化数据、数据库、账号信息

初始化数据库

superset db upgrade

创建管理员用户

superset fab create-admin

创建默认的权限和角色

superset load_examples

开启web服务,绑定端口

superset run -p 8088 --with-threads --reload --debugger

备注:初始化前操作,如果有提示下面这个错误

INFO:superset.utils.screenshots:No PIL installation found

执行下面的命令,安装PIL模块,总结一下:安装superset主要是安装python的依赖模块比较头痛,如果有提示什么模块不存在或者版本不正确,重新使用pip安装这个模块即可。然后重复上面的初始化操作。

pip install pillow

我个人的设置信息

First Name

Last Name

Username

xxxxxxxxxx@qq.com

Password

[Admin]

superset

admin

admin

763999883@qq.com

admin123

[Admin]

7、浏览器访问,使用账号密码登录

http://localhos:8088

8、配置连接MySQL的方式

在WebUI控制面板中,Source --> Database --> FILTER LIST,点击 号,增加数据库支持信息,

Database:数据库名称

SQLAlchemy URI:连接数据库的URI信息,格式参考下面的[SqlAlchemy docs]:

https://docs.sqlalchemy.org/en/12/core/engines.html#mysql

https://docs.sqlalchemy.org/en/12/dialects/mysql.html

连接mysql数据库之前,先把数据库驱动安装起来,否则将出现下面的错误信息

mysql-connector 方式

pip install mysql-connector-python Collecting mysql-connector-python Downloading mysql_connector_python-8.0.21-cp37-cp37m-macosx_10_14_x86_64.whl (4.8 MB) |████████████████████████████████| 4.8 MB 179 kB/s Collecting protobuf>=3.0.0 Downloading protobuf-3.12.2-cp37-cp37m-macosx_10_9_x86_64.whl (1.3 MB) |████████████████████████████████| 1.3 MB 302 kB/s Requirement already satisfied: six>=1.9 in /usr/local/lib/python3.7/site-packages (from protobuf>=3.0.0->mysql-connector-python) (1.15.0) Requirement already satisfied: setuptools in /usr/local/lib/python3.7/site-packages (from protobuf>=3.0.0->mysql-connector-python) (49.2.0) Installing collected packages: protobuf, mysql-connector-python Successfully installed mysql-connector-python-8.0.21 protobuf-3.12.2

输入连接命令

  • mysql mysqlconnector:l://account:password@host:port/DBName?charset=utf8

pymysql 方式

pip install pymysql 同样会看到安装成功(如果没有意外发生)

输入连接命令

  • mysql mysqlconnector:l://account:password@host:port/DBName?charset=utf8

错误信息预警:

  • mysql://root:Root1234@localhost/hello?charset=utf8

这种方式在我笔记本中连接,提示下面信息,这个我没有解决

Unexpected error name ‘_mysql’ is not defined ERROR:superset.views.core:Unexpected error name ‘_mysql’ is not defined

  • mysql pymysql://account:password@127.0.0.1:3306/dbtest?charset=utf8

这种方式在我笔记本中连接,提示下面信息,从上面可知,这是由于没有安装驱动导致,回到上面,执行安装驱动命令,再次执行即可。

;;;;;Unexpected error No module named ‘pymysql’ ERROR:superset.views.core:Unexpected error No module named ‘pymysql’

其他安装方式,请参考官网(http://superset.apache.org/)或者其他信息网站。

CentOS of Superset

如果你的机器已经安装了docker,可以直接略过docker直接查看superset。

安装前检查
1、当前操作系统以及其他软件版本

备注:如果下面的软件没有安装,请安装后再操作

1.1 Linux 操作系统的发行版本
代码语言:javascript复制
// 执行命令
$ cat /etc/redhat-release

// 输出结果
CentOS Linux release 7.6.1810 (Core)
1.2 Linux 操作系统的内核版本
代码语言:javascript复制
// 执行命令
$ uname -r

// 输出结果
CentOS Linux release 7.6.1810 (Core)
1.3 yum管理软件的版本信息
代码语言:javascript复制
// 执行命令
$ yum version

// 输出结果
已加载插件:fastestmirror, langpacks, product-id, search-disabled-repos, subscription-
          : manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

已安装: 7/x86_64                  XXX:ABCDEFG
组已安装: yum                       YY:BBCCDDEEFF

备注:由于我的服务器没有注册,给了订阅注册的提示信息,这个可以参考这里解决

出现问题

代码语言:javascript复制
This system is not registered with an entitlement server. You can use subscription-manager to register

解决方案

https://blog.csdn.net/oraoharu/article/details/106808108

https://www.cnblogs.com/caodneg7/p/11495099.html

Docker篇
1、安装前阅读

要在CentOS上开始使用Docker Engine,请确保您 满足先决条件,然后 安装Docker

  • 先觉条件

要安装Docker Engine,您需要一个CentOS 7的维护版本。不支持或未测试存档版本。

  • 启动centos-extras

centos-extras库必须启用。默认情况下,此存储库是启用的,但是如果已禁用它,则需要 重新启用它。 overlay2建议使用存储驱动程序。

1.1 已经安装的docker版本

如果之前没有安装过,或者当前机器为新机器,可以忽略这个操作

代码语言:javascript复制
// 执行命令
$ docker version

// 输出结果
Client: Docker Engine - Community
 Version:           19.03.12
 API version:       1.40
 Go version:        go1.13.10
 Git commit:        48a66213fe
 Built:             Mon Jun 22 15:46:54 2020
 OS/Arch:           linux/amd64
 Experimental:      false
Cannot connect to the Docker daemon at XXXXXX Is the docker daemon running?
1.2 卸载已安装的docker

卸载已经安装的docker客户端、docker服务端、docker引擎以及其他

代码语言:javascript复制
$ sudo yum remove docker 
                  docker-client 
                  docker-client-latest 
                  docker-common 
                  docker-latest 
                  docker-latest-logrotate 
                  docker-logrotate 
                  docker-engine
2、安装docker
  • 方式一:使用存储库安装docker

使用存储库安装是习惯性安装,使用习惯了Linux,你便会趋向使用这个模式来安装自己软件

设置存储库

代码语言:javascript复制
$ sudo yum install -y yum-utils

$ sudo yum-config-manager 
    --add-repo 
    https://download.docker.com/linux/centos/docker-ce.repo
2.1 安装Docker引擎

安装最新版本

代码语言:javascript复制
$ sudo yum install docker-ce docker-ce-cli containerd.io

安装特定(指定)版本

代码语言:javascript复制
// 查询版本列表
$ yum list docker-ce --showduplicates | sort -r

docker-ce.x86_64  3:18.09.1-3.el7                     docker-ce-stable
docker-ce.x86_64  3:18.09.0-3.el7                     docker-ce-stable
docker-ce.x86_64  18.06.1.ce-3.el7                    docker-ce-stable
docker-ce.x86_64  18.06.0.ce-3.el7                    docker-ce-stable

// 执行指定版本安装
$ sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io
2.2 启动Docker引擎
代码语言:javascript复制
$ sudo systemctl start docker

此处可能会出现各种问题,这里罗列下我遇到的问题

  • Warning: docker.service changed on disk. Run ‘systemctl daemon-reload’ to reload units.

解决方案:执行提示信息 systemctl daemon-reload

  • A dependency job for docker.service failed. See ‘journalctl -xe’ for details.

解决方案:执行journalctl -xe查看错误信息,例如我的错误信息如下

代码语言:javascript复制
8月 19 15:18:18 xxxxxx nm-dispatcher[51906]: req:1 'dhcp6-change' [em1], "/etc/NetworkManager/dispatcher.d/20-chrony": complete: failed to execute script: Failed to execute
8月 19 15:18:18 xxxxxx NetworkManager[3058]: <warn>  [1597821498.3743] dispatcher: (85) 00-netreport failed (exec failed): Failed to execute child process “/etc/NetworkManag
8月 19 15:18:18 xxxxxx NetworkManager[3058]: <warn>  [1597821498.3744] dispatcher: (85) 04-iscsi failed (exec failed): Failed to execute child process “/etc/NetworkManager/d
8月 19 15:18:18 xxxxxx NetworkManager[3058]: <warn>  [1597821498.3744] dispatcher: (85) 20-chrony failed (exec failed): Failed to execute child process “/etc/NetworkManager/
8月 19 15:18:18 xxxxxx systemd[1]: Started Network Manager Script Dispatcher Service.
-- Subject: Unit NetworkManager-dispatcher.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit NetworkManager-dispatcher.service has finished starting up.
--
-- The start-up result is done.
8月 19 15:20:01 xxxxxx systemd[1]: Started Session 3283 of user root.
-- Subject: Unit session-3283.scope has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-3283.scope has finished starting up.
--
-- The start-up result is done.
8月 19 15:20:01 xxxxxx CROND[52050]: (root) CMD (/usr/lib64/sa/sa1 1 1)
8月 19 15:20:01 xxxxxx CROND[52048]: (root) CMDOUT (execl: couldn't exec `/bin/sh')
8月 19 15:20:01 xxxxxx CROND[52048]: (root) CMDOUT (execl: 可执行文件格式错误)
lines 2165-2187/2187 (END)
2.3 验证Docker引擎是否安装正确
代码语言:javascript复制
$ sudo docker run hello-world

// or can excute 

$ docker version
  • 方式二:从软件包安装

略。请参考官方文档,文档地址:https://docs.docker.com/

Superset篇

0 人点赞