CDH 6.3.1 hue 4.4 Api 錯誤:500 Server Error: Server Error for url: http://x.x.x.x:9090

系統環境

CDH 6.3.1
Hue 4.4.0

問題現象

Hue中無法連接hbase表
![在這裏插入圖片描述](https://img-blog.csdnimg.cn/20200606112505253.png

問題排查

hue server 日誌:http://xxxx:8888/hue/logs

[05/Jun/2020 19:32:19 -0700] resource     DEBUG    GET //user/hbase Got response in 3ms: {"FileStatus":{"accessTime":0,"blockSize":0,"childrenNum":0,"fileId":22967,"group":"hbase","length":0,"modificationTime":1591409474471,"owner":"hbase","pathSuffix":"","permission":"755","replication":0,"storagePolicy":0,"type":"DIRECTORY"}}
[05/Jun/2020 19:32:19 -0700] connectionpool DEBUG    http://master01-prod.cdh:9870 "GET /webhdfs/v1/user/hbase?op=GETFILESTATUS&user.name=hue&doas=hbase HTTP/1.1" 200 None
[05/Jun/2020 19:32:19 -0700] connectionpool DEBUG    Starting new HTTP connection (1): master01-prod.cdh
[05/Jun/2020 19:32:17 -0700] views        WARNING  User hbase is bypassing the load balancer
[05/Jun/2020 19:32:14 -0700] access       INFO     192.168.8.69 hbase - "POST /desktop/log_analytics HTTP/1.1" returned in 1ms
[05/Jun/2020 19:32:14 -0700] access       INFO     192.168.8.69 hbase - "POST /desktop/log_analytics HTTP/1.1"-- PAGE: hue/leftNavVisible/true
[05/Jun/2020 19:32:06 -0700] access       INFO     192.168.8.69 hue - "GET /hbase/api/getTableList/HBase HTTP/1.1" returned in 66ms
[05/Jun/2020 19:32:06 -0700] middleware   INFO     Processing exception: Api 錯誤:500 Server Error: Server Error for url: http://master02-prod.cdh:9090/: Traceback (most recent call last):
  File "/opt/cloudera/parcels/CDH-6.3.1-1.cdh6.3.1.p0.1470567/lib/hue/build/env/lib/python2.7/site-packages/Django-1.11.20-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.3.1-1.cdh6.3.1.p0.1470567/lib/hue/build/env/lib/python2.7/site-packages/Django-1.11.20-py2.7.egg/django/utils/decorators.py", line 185, in inner
    return func(*args, **kwargs)
  File "/opt/cloudera/parcels/CDH-6.3.1-1.cdh6.3.1.p0.1470567/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.3.1-1.cdh6.3.1.p0.1470567/lib/hue/apps/hbase/src/hbase/api.py", line 54, in query
    raise PopupException(_("Api Error: %s") % error_msg)
PopupException: Api \u9519\u8bef\uff1a500 Server Error: Server Error for url: http://master02-prod.cdh:9090/
[05/Jun/2020 19:32:06 -0700] exceptions_renderable ERROR    Potential trace: [('/opt/cloudera/parcels/CDH-6.3.1-1.cdh6.3.1.p0.1470567/lib/hue/apps/hbase/src/hbase/api.py', 46, 'query', 'return getattr(self, action)(*args)'), ('/opt/cloudera/parcels/CDH-6.3.1-1.cdh6.3.1.p0.1470567/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.3.1-1.cdh6.3.1.p0.1470567/lib/hue/desktop/core/src/desktop/lib/thrift_util.py', 407, 'wrapper', 'return attr(*args, **kwargs)'), ('/opt/cloudera/parcels/CDH-6.3.1-1.cdh6.3.1.p0.1470567/lib/hue/desktop/core/src/desktop/lib/thrift_util.py', 473, 'wrapper', 'ret = res(*args, **kwargs)'), ('/opt/cloudera/parcels/CDH-6.3.1-1.cdh6.3.1.p0.1470567/lib/hue/apps/hbase/gen-py/hbased/Hbase.py', 54, 'decorate', 'return func(*args, **kwargs)'), ('/opt/cloudera/parcels/CDH-6.3.1-1.cdh6.3.1.p0.1470567/lib/hue/apps/hbase/gen-py/hbased/Hbase.py', 838, 'getTableNames', 'self.send_getTableNames()'), ('/opt/cloudera/parcels/CDH-6.3.1-1.cdh6.3.1.p0.1470567/lib/hue/apps/hbase/gen-py/hbased/Hbase.py', 846, 'send_getTableNames', 'self._oprot.trans.flush()'), ('/opt/cloudera/parcels/CDH-6.3.1-1.cdh6.3.1.p0.1470567/lib/hue/build/env/lib/python2.7/site-packages/thrift-0.9.1-py2.7-linux-x86_64.egg/thrift/transport/TTransport.py', 170, 'flush', 'self.__trans.flush()'), ('/opt/cloudera/parcels/CDH-6.3.1-1.cdh6.3.1.p0.1470567/lib/hue/desktop/core/src/desktop/lib/thrift_/http_client.py', 87, 'flush', "self._data = self._root.post('', data=data, headers=self._headers)"), ('/opt/cloudera/parcels/CDH-6.3.1-1.cdh6.3.1.p0.1470567/lib/hue/desktop/core/src/desktop/lib/rest/resource.py', 157, 'post', 'allow_redirects=allow_redirects, clear_cookies=clear_cookies, log_response=log_response)'), ('/opt/cloudera/parcels/CDH-6.3.1-1.cdh6.3.1.p0.1470567/lib/hue/desktop/core/src/desktop/lib/rest/resource.py', 80, 'invoke', 'log_response=log_response)'), ('/opt/cloudera/parcels/CDH-6.3.1-1.cdh6.3.1.p0.1470567/lib/hue/desktop/core/src/desktop/lib/rest/resource.py', 99, '_invoke', 'clear_cookies=clear_cookies)'), ('/opt/cloudera/parcels/CDH-6.3.1-1.cdh6.3.1.p0.1470567/lib/hue/desktop/core/src/desktop/lib/rest/http_client.py', 215, 'execute', 'raise self._exc_class(ex)')]
[05/Jun/2020 19:32:06 -0700] thrift_util  INFO     Thrift saw exception: 500 Server Error: Server Error for url: http://master02-prod.cdh:9090/
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 500 </title>
</head>
<body>
<h2>HTTP ERROR: 500</h2>
<p>Problem accessing /. Reason:
<pre>    javax.servlet.ServletException: org.apache.hadoop.security.authorize.AuthorizationException: User: hbase is not allowed to impersonate hue</pre></p>
<hr />
</body>
</html>
 (error 500)
[05/Jun/2020 19:32:06 -0700] thrift_util  ERROR    Thrift saw exception (this may be expected).
Traceback (most recent call last):
  File "/opt/cloudera/parcels/CDH-6.3.1-1.cdh6.3.1.p0.1470567/lib/hue/desktop/core/src/desktop/lib/thrift_util.py", line 473, in wrapper
    ret = res(*args, **kwargs)
  File "/opt/cloudera/parcels/CDH-6.3.1-1.cdh6.3.1.p0.1470567/lib/hue/apps/hbase/gen-py/hbased/Hbase.py", line 54, in decorate
    return func(*args, **kwargs)
  File "/opt/cloudera/parcels/CDH-6.3.1-1.cdh6.3.1.p0.1470567/lib/hue/apps/hbase/gen-py/hbased/Hbase.py", line 838, in getTableNames
    self.send_getTableNames()
  File "/opt/cloudera/parcels/CDH-6.3.1-1.cdh6.3.1.p0.1470567/lib/hue/apps/hbase/gen-py/hbased/Hbase.py", line 846, in send_getTableNames
    self._oprot.trans.flush()
  File "/opt/cloudera/parcels/CDH-6.3.1-1.cdh6.3.1.p0.1470567/lib/hue/build/env/lib/python2.7/site-packages/thrift-0.9.1-py2.7-linux-x86_64.egg/thrift/transport/TTransport.py", line 170, in flush
    self.__trans.flush()
  File "/opt/cloudera/parcels/CDH-6.3.1-1.cdh6.3.1.p0.1470567/lib/hue/desktop/core/src/desktop/lib/thrift_/http_client.py", line 87, in flush
    self._data = self._root.post('', data=data, headers=self._headers)
  File "/opt/cloudera/parcels/CDH-6.3.1-1.cdh6.3.1.p0.1470567/lib/hue/desktop/core/src/desktop/lib/rest/resource.py", line 157, in post
    allow_redirects=allow_redirects, clear_cookies=clear_cookies, log_response=log_response)
  File "/opt/cloudera/parcels/CDH-6.3.1-1.cdh6.3.1.p0.1470567/lib/hue/desktop/core/src/desktop/lib/rest/resource.py", line 80, in invoke
    log_response=log_response)
  File "/opt/cloudera/parcels/CDH-6.3.1-1.cdh6.3.1.p0.1470567/lib/hue/desktop/core/src/desktop/lib/rest/resource.py", line 99, in _invoke
    clear_cookies=clear_cookies)
  File "/opt/cloudera/parcels/CDH-6.3.1-1.cdh6.3.1.p0.1470567/lib/hue/desktop/core/src/desktop/lib/rest/http_client.py", line 215, in execute
    raise self._exc_class(ex)
RestException: 500 Server Error: Server Error for url: http://master02-prod.cdh:9090/
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 500 </title>
</head>
<body>
<h2>HTTP ERROR: 500</h2>
<p>Problem accessing /. Reason:
<pre>    javax.servlet.ServletException: org.apache.hadoop.security.authorize.AuthorizationException: User: hbase is not allowed to impersonate hue</pre></p>
<hr />
</body>
</html>
 (error 500)

問題核心原因:

org.apache.hadoop.security.authorize.AuthorizationException: User: hbase is not allowed to impersonate hue

問題解決

  1. 修改配置
    在CloudManager的HDFS服務->高級->core-site.xml增加如下配置:

在這裏插入圖片描述
2. 重啓相關服務

參考資料

1、https://stackoverflow.com/questions/42522341/cant-access-hbase-through-hue

2、https://developer.aliyun.com/ask/127216

3、https://stackoverflow.com/questions/38520724/cdh-hue-and-hbase-authentication

4、https://www.cnblogs.com/zlslch/p/6819622.html

5、https://my.oschina.net/hblt147/blog/1920466

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章