尝试使用 Kerberos 将 Apache Superset 1.3 与 Trino/Presto 连接。能够使用 pip install pyhive['presto']==0.6.2 成功安装插件,也尝试了其他版本。
尝试进行连接测试时,出现以下错误
[SupersetError(message='(builtins.NoneType) None\n(此错误的背景:http://sqlalche.me/e/13/dbapi)', error_type=<SupersetErrorType.GENERIC_DB_ENGINE_ERROR: 'GENERIC_DB_ENGINE_ERROR'>, 级别=<ErrorLevel.ERROR: 'error' >, extra={'engine_name': 'Presto', 'issue_codes': [{'code': 1002, 'message': 'Issue 1002 - 数据库返回意外错误。' }]})] 2021-09-03 10:22:54,708:WARNING:superset.views.base:[SupersetError(message='(builtins.NoneType) None\n(此错误的背景:http://sqlalche .me/e/13/dbapi)', error_type=<SupersetErrorType.GENERIC_DB_ENGINE_ERROR: 'GENERIC _DB_ENGINE_ERROR'>, level=<ErrorLevel.ERROR: 'error'>, extra={'engine_name': 'Presto', 'issue_codes' : [{'代码': 1002, 'message': '问题 1002 - 数据库返回意外错误
我在我的 engine_params 中尝试了这个配置
"kerberos_principal" : "myuser@MYDOMAIN.COM", "requests_kwargs": {"verify":""}}}
Superset 文档指出这是后端数据库的问题,即 Presto https://superset.apache.org/docs/miscellaneous/issue-codes
使用 LDAP 进行这项工作绝对没有问题,即用户名:密码问题只是使用 kerberos。
为了进一步调试,从 python 和 SQLAlchemy 层,我尝试了这些步骤与 LDAP 完美结合
>>> from sqlalchemy import *
>>> from sqlalchemy.engine import create_engine
>>> from sqlalchemy.schema import *
>>> engine = create_engine('presto://myuser:mypassword@presto-coordinator:8080/hive/default', connect_args={'protocol': 'https','port' : 8080,'auth':'Kerberos','Kerberos_Config_Path':'/etc/krb5.conf','Kerberos_Keyta
b_Path':'/opt/superset/mykeytab.keytab','Kerberos_Principal':'myuser@MYDOMAIN.COM','Kerberos_Remote_Service_Name':'presto'})
但是,一个接一个地,我们不断收到错误,其中 kerberos 特定属性为“未知”,以“auth”开头,然后抱怨所有 kerberos 密钥,即“kerberos_principal”、“kerberos_config_path”等。
Traceback (most recent call last):
File "/opt/app-root/lib64/python3.8/site-packages/sqlalchemy/engine/base.py", line 1204, in _execute_context
context = constructor(dialect, self, conn, *args)
File "/opt/app-root/lib64/python3.8/site-packages/sqlalchemy/engine/default.py", line 1044, in _init_statement
self.cursor = self.create_cursor()
File "/opt/app-root/lib64/python3.8/site-packages/sqlalchemy/engine/default.py", line 1177, in create_cursor
return self._dbapi_connection.cursor()
File "/opt/app-root/lib64/python3.8/site-packages/sqlalchemy/pool/base.py", line 1000, in cursor
return self.connection.cursor(*args, **kwargs)
File "/opt/app-root/lib64/python3.8/site-packages/pyhive/presto.py", line 67, in cursor
return Cursor(*self._args, **self._kwargs)
TypeError: __init__() got an unexpected keyword argument 'auth'
有没有类似经历的可以分享一下吗??