温馨提示:如果使用电脑查看图片不清晰,可以使用手机打开文章单击文中的图片放大查看高清原图。




Fayson的github:

​https://github.com/fayson/cdhproject​




提示:代码块部分可以左右滑动查看噢



1

问题重现


  • 测试环境

1.Redhat7.4

2.CDH6.1.1


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


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


0647-6.1.1-Hue集成HBase出现Api Error异常分析(续)_django


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


0647-6.1.1-Hue集成HBase出现Api Error异常分析(续)_cloudera_02


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


0647-6.1.1-Hue集成HBase出现Api Error异常分析(续)_hadoop_03


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


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


0647-6.1.1-Hue集成HBase出现Api Error异常分析(续)_django_04


3

问题解决


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


0647-6.1.1-Hue集成HBase出现Api Error异常分析(续)_cloudera_05


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


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


0647-6.1.1-Hue集成HBase出现Api Error异常分析(续)_cloudera_06


4

总结


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

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


提示:代码块部分可以左右滑动查看噢

为天地立心,为生民立命,为往圣继绝学,为万世开太平。

温馨提示:如果使用电脑查看图片不清晰,可以使用手机打开文章单击文中的图片放大查看高清原图。


推荐关注Hadoop实操,第一时间,分享更多Hadoop干货,欢迎转发和分享。

0647-6.1.1-Hue集成HBase出现Api Error异常分析(续)_hadoop_07

原创文章,欢迎转载,转载请注明:转载自微信公众号Hadoop实操