####python连接有kerberos验证的hiveserver2 import pyhs2 import thrift config = {'krb_host':'hiveserver-$clustername.s3s.altiscale.com', 'krb_service':'hiveserver','hive.server2.proxy.user':'ceshi'} db_conn=pyhs2.connect(host="hiveserver-$clustername.s3s.altiscale.com", port=10000, authMechanism="KERBEROS", user="", password="", configuration=config) cur = db_conn.cursor() cur.execute("use default") cur.execute("show tables") for i in cur: print i