admin管理员组

文章数量:1551229

Fayson的github: https://github/fayson/cdhproject

推荐关注微信公众号:“Hadoop实操”,ID:gh_c4c535955d0f

1 问题重现

  • 测试环境

1.Redhat7.4

2.CDH6.1.1

Fayson在前面《0635-5.16.1-Hue集成HBase出现Api Error异常分析》文章中说明了在C5中Hue与HBase集成问题,本篇文章主要分析C6环境下进行异常。

1.登录Hue进入HBase模块异常显示如下

2.查看Hue服务的日志有如下报错信息

ERROR   exceptions_renderable   Potential trace: [('/opt/cloudera/parcels/CDH-6.1.1-1.cdh6.1.1.p0.875250/lib/hue/apps/hbase/src/hbase/api.py', 46, 'query', 'return getattr(self, action)(*args)'), ('/opt/cloudera/parcels/CDH-6.1.1-1.cdh6.1.1.p0.875250/lib/hue/apps/hbase/src/hbase/api.py', 142, 'getTableList', "return [{'name': name, 'enabled': client.isTableEnabled(name, doas=self.user.username)} for name in client.getTableNames(doas=self.user.username)]"), ('/opt/cloudera/parcels/CDH-6.1.1-1.cdh6.1.1.p0.875250/lib/hue/desktop/core/src/desktop/lib/thrift_util.py', 420, 'wrapper', 'raise StructuredThriftTransportException(e, error_code=502)')]
INFO    middleware  Processing exception: Api Error: TSocket read 0 bytes: Traceback (most recent call last):
  File "/opt/cloudera/parcels/CDH-6.1.1-1.cdh6.1.1.p0.875250/lib/hue/build/env/lib/python2.7/site-packages/Django-1.11-py2.7.egg/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/cloudera/parcels/CDH-6.1.1-1.cdh6.1.1.p0.875250/lib/hue/build/env/lib/python2.7/site-packages/Django-1.11-py2.7.egg/django/utils/decorators.py", line 185, in inner
    return func(*args, **kwargs)
  File "/opt/cloudera/parcels/CDH-6.1.1-1.cdh6.1.1.p0.875250/lib/hue/apps/hbase/src/hbase/views.py", line 80, in api_router
    return api_dump(HbaseApi(request.user).query(*url_params))
  File "/opt/cloudera/parcels/CDH-6.1.1-1.cdh6.1.1.p0.875250/lib/hue/apps/hbase/src/hbase/api.py", line 54, in query
    raise PopupException(_("Api Error: %s") % error_msg)
PopupException: Api Error: TSocket read 0 bytes

2 异常分析

1.通过查看Hue的配置文件hue.ini看到HBase的配置模块有如下信息

# Should come from hbase-site.xml, do not set. 'framed' is used to chunk up responses, used with the nonblocking server in Thrift but is not supported in Hue.
  # 'buffered' used to be the default of the HBase Thrift Server. Default is buffered when not set in hbase-site.xml.
  ## thrift_transport=buffered

通过上述配置信息可以看到Hue与HBase Thrift默认使用的是buffered模式,当前是不支持Framed。

2.通过CM查看HBase Thrift服务framed配置为如下

3 问题解决

1.进入HBase的配置页面将Thrift服务的如下两个配置禁用

修改上述配置后,重启HBase的Thrift服务。

2.登录Hue验证是否生效,如下图所示Hue可以正常访问HBase的表

4 总结

1.在CDH6中HBase Thrift Server服务默认启用了hbase.regionserver.thriftpact和hbase.regionserver.thrift.framed参数,这样HBase会使用framed的方式进行传输。

2.在CDH6中Hue恰恰将默认的传输模式修改为了buffered模式,从而导致Hue无法正常访问HBase Thrift。

本文标签: 异常HueErrorAPIHbase