Skip to content Skip to sidebar Skip to footer

Connecting To Kerberized Hadoop Cluster Using Python Module Impyla

I am using impyla module to connect to kerberized hadoop cluster. I want to access hiveserver2/hive but I was getting the below error: test_conn.py from impala.dbapi import connect

Solution 1:

Your connection appears to be incorrect.. Try,

from impala.dbapi import *
import sys, os
# set your parms
host=os.environ.get("CDH_HIVE",'x.x.x.x')
port=os.environ.get("CDH_HIVE_port",'10000')
auth_mechanism=os.environ.get("CDH_auth",'GSSAPI')
user='hive' 
db='mydb' 
# No password use kinit 
password=''
# hive is principal with krb
kbservice='hive'  

class Hive:

    def __init__(self,db):
        self.database=db
        self.__conn = connect(host=host,
                            port=port,
                            auth_mechanism=auth_mechanism,
                            user=user,
                            password=password,
                            database=db,
                            kerberos_service_name=kbservice
                            )


        self.__cursor = self.__conn.cursor()


h = Hive(db)

Post a Comment for "Connecting To Kerberized Hadoop Cluster Using Python Module Impyla"