[HADOOP] pyhive, SQLAlchemy의 샌드 박스를 하둡에 연결할 수 없습니다
HADOOPpyhive, SQLAlchemy의 샌드 박스를 하둡에 연결할 수 없습니다
내가 설치 한,
pip install thrift
pip install PyHive
pip install thrift-sasl
과 SASL를 설치 핍하는 것은 실패 이후는 SASL-0.2.1-cp27-cp27m-win_amd64.whl 파일을 다운로드하고 내 Windows 8.1 PC에 설치되어 있어야합니다.
그럼이 코드를 작성
from pyhive import hive
cursor = hive.connect('192.168.1.232', port=10000, auth='NONE')
cursor.execute('SELECT * from sample_07 LIMIT 5',async=True)
print cursor.fetchall()
이 오류를 제공합니다 :
Traceback (most recent call last):
File "C:/DigInEngine/scripts/UserManagementService/fd.py", line 37, in <module>
cursor = hive.connect('192.168.1.232', port=10000, auth = 'NONE')
File "C:\Python27\lib\site-packages\pyhive\hive.py", line 63, in connect
return Connection(*args, **kwargs)
File "C:\Python27\lib\site-packages\pyhive\hive.py", line 104, in __init__
self._transport.open()
File "C:\Python27\lib\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: Unable to find a callback: 2
이 코드는 제공
from sqlalchemy import create_engine
engine = create_engine('hive://192.168.1.232:10000/default')
try:
connection = engine.connect()
except Exception, err:
print err
result = connection.execute('select * from sample_07;')
engine.dispose()
이 오류,
여기에서 호튼 웍스에게 샌드 박스를 다운로드하여 별도의 서버에서 사용했다.
참고 : 나뿐만 아니라이 겪었지만이 핍 하이브를 설치하고 있지만 하이브에서 ThriftHive 가져 오기 가져 오기 오류를 제공하기 때문에 허용 대답은 나를 위해 작동하지 않습니다. 그래서 pyhive 또는 SQLAlchemy의를 사용하기로 결정
어떻게 하이브 쉽게 쿼리를 실행 연결할 수 있습니까?
해결법
-
==============================
1.어떤 인증이 대신 "없음"으로, 인증 = "NOSASL"로 전달 될 수 없다 pyhive 사용하는 동안, 그래서 당신의 코드는 다음과 같아야합니다 :
어떤 인증이 대신 "없음"으로, 인증 = "NOSASL"로 전달 될 수 없다 pyhive 사용하는 동안, 그래서 당신의 코드는 다음과 같아야합니다 :
from pyhive import hive cursor = hive.connect('192.168.1.232', port=10000, auth='NOSASL') cursor.execute('SELECT * from sample_07 LIMIT 5',async=True) print cursor.fetchall()
-
==============================
2.다음은 Windows에 SASL를 구축하는 단계입니다,하지만 마일리지가 다를 수 있습니다 이것의 많은 특정 시스템의 경로 및 사용 가능한 라이브러리에 따라 달라집니다.
다음은 Windows에 SASL를 구축하는 단계입니다,하지만 마일리지가 다를 수 있습니다 이것의 많은 특정 시스템의 경로 및 사용 가능한 라이브러리에 따라 달라집니다.
이러한 지침 (나는 당신이 당신의 문제의 경로에서 사용 참조) 파이썬 2.7에 고유 있습니다.
https://github.com/cyrusimap/cyrus-sasl : 높은 수준의 개요는이 프로젝트를 설치하는 것입니다. 그렇게하기 위해서는, 당신은 파이썬 2.7을 구축하는 데 사용 된 기존의 C ++ 컴파일러를 사용합니다. 이 작업을 얻기에 다른 단계의 몇 가지 있습니다.
사전 빌드 단계 :
단계를 구축 :
위치를 '포함'
다음은이 같은 단계에 대한 참조 몇 가지 추가 주석 및 설명과 함께,이다 : http://java2developer.blogspot.co.uk/2016/08/making-impala-connection-from-python-on.html.
노트 에서 참조 된 명령도 실행 단계 (8)는 Win32 \ 하위 디렉토리를 포함 포함하고, 당신은뿐만 아니라 그렇게 할 수 있습니다.
from https://stackoverflow.com/questions/42210901/pyhive-sqlalchemy-can-not-connect-to-hadoop-sandbox by cc-by-sa and MIT license
'HADOOP' 카테고리의 다른 글
[HADOOP] 어떻게 동적으로 Dataproc에서 작업자의 CPU / RAM / 디스크를 업그레이드? (0) | 2019.10.21 |
---|---|
[HADOOP] SQL로 감소 ES 쿼리 결과를 전달 (0) | 2019.10.21 |
[HADOOP] 명령 행 (CDH 5)을 사용하여 하둡 서비스 시작 (0) | 2019.10.21 |
[HADOOP] 하둡에서의 ClassNotFoundException (0) | 2019.10.21 |
[HADOOP] 실패 기어 (0) | 2019.10.21 |