impyla: SASL Error: no mechanism available: No worthy mechs found
When trying to connect to an Impala Server, the following error happens:
>>> from impala.dbapi import connect
>>> conn = connect(host='xxxxxxxxxx', port=21050, user='xxxxxx', password='xxxxxx', auth_mechanism='LDAP')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.6/site-packages/impala/dbapi.py", line 82, in connect
auth_mechanism=auth_mechanism)
File "/usr/local/lib/python2.6/site-packages/impala/hiveserver2.py", line 586, in connect
transport.open()
File "/usr/local/lib/python2.6/site-packages/thrift_sasl/__init__.py", line 72, in open
message=("Could not start SASL: %s" % self.sasl.getError()))
thrift.transport.TTransport.TTransportException: Could not start SASL: Error in sasl_client_start (-4) SASL(-4): no mechanism available: No worthy mechs found
Even with all LDAP dependencies installed.
About this issue
- Original URL
- State: open
- Created 9 years ago
- Comments: 46 (14 by maintainers)
Commits related to this issue
- Improve prerequisite info about SASL Document later thrift-sasl versions as supported Add some info about how to install SASL libraries on different distros (taken from #149). — committed to timarmstrong/impyla by deleted user 4 years ago
- Improve prerequisite info about SASL (#394) Document later thrift-sasl versions as supported Add some info about how to install SASL libraries on different distros (taken from #149). — committed to cloudera/impyla by timarmstrong 4 years ago
for what it’s worth, this solved it for me
running python in Docker
I have this working now on a CentOS install of Anaconda. I think that the critical aspect in getting this functioning was installing several sasl related packages on CentOS itself.
I was unable to compile SASL on Windows (or any of the CentOS) packages, so leveraged the CentOS VM to connect to the Kerberos cluster.
After successfully running a kinit, I am able to connect with the following string:
LDAP conection works as well:
If it can help anyone, here’s a dockerfile for python 3.7
I ran the following command and it fixed my issue. There might be some issues on redhat with missing dependencies
yum install cyrus-sasl-md5 cyrus-sasl-plain cyrus-sasl-gssapi cyrus-sasl-devel -y
There’s a workaround for LDAP connection problem. You need to do yum install saslwrapper and saslwrapper-devel, then connect to impala with PLAIN mechanism.
If you don’t install saslwrapper, you will get a timeout error.
When trying GSSAPI to connect to a secured CDH Hive instance then I get the following
From beeline it is working fine.
So the easiest (although less performant) solution is to uninstall the Sasl python library and install puresasl and kerberos.
Puresasl doesn’t require any changes deps for plain Auth and impyla will fall back to using it.
Sounds like we should try to get conda-forge builds of cyrus-sasl possibly (I’m not sure what folks’ general thoughts on handling security libraries). I’m not sure when I’ll have time to work on it, though
Just a note, I believe that the pertinent issue here is the use of Anaconda. The install of the cyrus packages, which would normally provide the necessities for GSSAPI, is providing bindings for the system python, not the Anaconda python. I say this as someone who is facing a similar challenge with another package requiring sasl running under Anaconda.
@richban Can you try using this slightly forked version of python-sasl (which uses Cython instead of SWIG for wrapping): https://github.com/cloudera/python-sasl
@richban We’ve tried all thinkable dependencies, without success.