티스토리 뷰
python
[pyhive] pyhive에서 커버로스 인증을 사용할 때 no mechanism available: No worthy mechs found 오류
hs_seo 2023. 8. 19. 08:49PyHive에서 커버로스 인증을 사용할 때 다음과 같은 오류가 발생 하였습니다.
File "/usr/local/lib/python3.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
이 오류는 cyrus-sasl 라이브러리가 설치 되어 있지 않을 때 발생합니다.
우분투 기준으로 다음과 같이 라이브러리를 설치 하였습니다.
apt-get install -y
cyrus-sasl2-doc \
libsasl2-2 \
libsasl2-dev \
libsasl2-modules \
libsasl2-modules-gssapi-mit \
libsasl2-modules-db \
libsasl2-modules-ldap \
libsasl2-modules-otp \
libsasl2-modules-sql \
sasl2-bin \
libkrb5-dev
라이브러리 설치 후에는 정상 동작 하였습니다.
설치 시 주의 할 점은 libsasl2-modules-gssapi-mit, libsasl2-modules-gssapi-heimdal 라이브러리는 동시에 설치가 안됩니다. Conflict 오류가 발생하기 때문에 하나만 설치 하셔도 됩니다.
https://launchpad.net/ubuntu/+source/cyrus-sasl2
cyrus-sasl2 package : Ubuntu
launchpad.net
설치 후 테스트 코드는 다음과 같습니다.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyhive import hive | |
from TCLIService.ttypes import TOperationState | |
conn = hive.connect(host='test.com', | |
port=10000, | |
database='default', | |
auth='KERBEROS', | |
username='hive_user', | |
kerberos_service_name='hive').cursor() | |
cursor = conn.cursor() | |
cursor.execute("show databases") | |
for r in cursor.fetchall(): | |
print(r) |
추가 확인 사항
이 방법은 hiveserver2의 transport mode 가 http 일 때 동작합니다. hiveserver2의 모드가 binary 일 때도 이와 동일한 오류가 발생합니다. 따라서 이 설정을 추가 하기 전에 hiveserver2의 설정을 확인해야 합니다.
<property>
<name>hive.server2.transport.mode</name>
<value>http</value>
</property>
반응형
'python' 카테고리의 다른 글
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- SPARK
- error
- Hadoop
- S3
- 하이브
- SQL
- Linux
- 다이나믹
- 백준
- bash
- HDFS
- 하둡
- ubuntu
- 오류
- 파이썬
- Python
- airflow
- java
- 정올
- mysql
- 알고리즘
- hbase
- emr
- nodejs
- Tez
- yarn
- HIVE
- build
- AWS
- oozie
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
글 보관함