AWS-EMR & Airflow 调度hivesql 异常thrift.transport.TTransport.TTransportException: TSocket read 0 bytes

2 篇文章 0 订阅
1 篇文章 0 订阅

通过Airflow 调用 EMR 中的hive 执行sql,遇到错误异常

 hh = HiveServer2Hook(
        hiveserver2_conn_id="hive_connect_emr"
    )
    res = hh.get_pandas_df("show tables")

[2022-10-13, 21:46:21 ] {{taskinstance.py:1703}} ERROR - Task failed with exception
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/airflow/models/taskinstance.py”, line 1332, in _run_raw_task
self._execute_task_with_callbacks(context)
File “/usr/local/lib/python3.7/site-packages/airflow/models/taskinstance.py”, line 1458, in _execute_task_with_callbacks
result = self._execute_task(context, self.task)
File “/usr/local/lib/python3.7/site-packages/airflow/models/taskinstance.py”, line 1514, in _execute_task
result = execute_callable(context=context)
File “/usr/local/lib/python3.7/site-packages/airflow/operators/python.py”, line 151, in execute
return_value = self.execute_callable()
File “/usr/local/lib/python3.7/site-packages/airflow/operators/python.py”, line 162, in execute_callable
return self.python_callable(*self.op_args, **self.op_kwargs)
File “/usr/local/airflow/dags/netease_hiev_hook.py”, line 29, in execSQLDWD
res = hh.get_pandas_df(“show tables”)
File “/usr/local/airflow/.local/lib/python3.7/site-packages/airflow/providers/apache/hive/hooks/hive.py”, line 1062, in get_pandas_df
res = self.get_results(hql, schema=schema, hive_conf=hive_conf)
File “/usr/local/airflow/.local/lib/python3.7/site-packages/airflow/providers/apache/hive/hooks/hive.py”, line 949, in get_results
header = next(results_iter)
File “/usr/local/airflow/.local/lib/python3.7/site-packages/airflow/providers/apache/hive/hooks/hive.py”, line 885, in _get_results
with contextlib.closing(self.get_conn(schema)) as conn, contextlib.closing(conn.cursor()) as cur:
File “/usr/local/airflow/.local/lib/python3.7/site-packages/airflow/providers/apache/hive/hooks/hive.py”, line 870, in get_conn
database=schema or db.schema or ‘default’,
File “/usr/local/airflow/.local/lib/python3.7/site-packages/pyhive/hive.py”, line 104, in connect
return Connection(*args, **kwargs)
File “/usr/local/airflow/.local/lib/python3.7/site-packages/pyhive/hive.py”, line 249, in init
response = self._client.OpenSession(open_session_req)
File “/usr/local/airflow/.local/lib/python3.7/site-packages/TCLIService/TCLIService.py”, line 187, in OpenSession
return self.recv_OpenSession()
File “/usr/local/airflow/.local/lib/python3.7/site-packages/TCLIService/TCLIService.py”, line 199, in recv_OpenSession
(fname, mtype, rseqid) = iprot.readMessageBegin()
File “/usr/local/airflow/.local/lib/python3.7/site-packages/thrift/protocol/TBinaryProtocol.py”, line 148, in readMessageBegin
name = self.trans.readAll(sz)
File “/usr/local/airflow/.local/lib/python3.7/site-packages/thrift/transport/TTransport.py”, line 62, in readAll
chunk = self.read(sz - have)
File “/usr/local/airflow/.local/lib/python3.7/site-packages/thrift/transport/TTransport.py”, line 164, in read
self.__rbuf = BufferIO(self.__trans.read(max(sz, self.__rbuf_size)))
File “/usr/local/airflow/.local/lib/python3.7/site-packages/thrift/transport/TSocket.py”, line 167, in read
message=‘TSocket read 0 bytes’)
thrift.transport.TTransport.TTransportException: TSocket read 0 bytes

修改hive-site.xml

增加 hive.server2.authentication 设置为NOSASL

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值