通过Cloudera添加Hue服务完成后,HueServer启动异常,导致8888端口无法浏览器访问。
1. cloudera管理平台报错信息如下
2. 浏览器报错如下
(1) /var/log/hue/syncdb.log && /var/log/hue/migrate.log
[02/May/2018 19:38:37 ] settings INFO Welcome to Hue 3.9.0
[02/May/2018 04:38:40 -0700] __init__ INFO Couldn't import snappy. Support for snappy compression disabled.
(2) /var/log/hue/error.log
[02/May/2018 19:28:04 -0700] file_reporter ERROR failed to write metrics to file
Traceback (most recent call last):
File "/opt/cloudera/parcels/CDH-5.12.2-1.cdh5.12.2.p0.4/lib/hue/desktop/core/src/desktop/lib/metrics/file_reporter.py", line 51, in report_now
json.dump(self.registry.dump_metrics(), f)
File "/opt/cloudera/parcels/CDH-5.12.2-1.cdh5.12.2.p0.4/lib/hue/desktop/core/src/desktop/lib/metrics/registry.py", line 107, in dump_metrics
metrics = self._registry.dump_metrics()
File "/opt/cloudera/parcels/CDH-5.12.2-1.cdh5.12.2.p0.4/lib/hue/build/env/lib/python2.7/site-packages/pyformance-0.3.2-py2.7.egg/pyformance/registry.py", line 215, in dump_metrics
metrics[key] = self.get_metrics(key)
File "/opt/cloudera/parcels/CDH-5.12.2-1.cdh5.12.2.p0.4/lib/hue/build/env/lib/python2.7/site-packages/pyformance-0.3.2-py2.7.egg/pyformance/registry.py", line 199, in get_metrics
metrics.update(getter(key))
File "/opt/cloudera/parcels/CDH-5.12.2-1.cdh5.12.2.p0.4/lib/hue/build/env/lib/python2.7/site-packages/pyformance-0.3.2-py2.7.egg/pyformance/registry.py", line 132, in _get_gauge_metrics
return {"value": gauge.get_value()}
File "/opt/cloudera/parcels/CDH-5.12.2-1.cdh5.12.2.p0.4/lib/hue/build/env/lib/python2.7/site-packages/pyformance-0.3.2-py2.7.egg/pyformance/meters/gauge.py", line 36, in get_value
return self.callback()
File "/opt/cloudera/parcels/CDH-5.12.2-1.cdh5.12.2.p0.4/lib/hue/apps/useradmin/src/useradmin/metrics.py", line 23, in active_users
return UserProfile.objects.filter(last_activity__gt=datetime.now() - timedelta(hours=1)).count()
File "/opt/cloudera/parcels/CDH-5.12.2-1.cdh5.12.2.p0.4/lib/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/query.py", line 294, in count
return self.query.get_count(using=self.db)
File "/opt/cloudera/parcels/CDH-5.12.2-1.cdh5.12.2.p0.4/lib/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/sql/query.py", line 390, in get_count
number = obj.get_aggregation(using=using)[None]
File "/opt/cloudera/parcels/CDH-5.12.2-1.cdh5.12.2.p0.4/lib/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/sql/query.py", line 356, in get_aggregation
result = query.get_compiler(using).execute_sql(SINGLE)
File "/opt/cloudera/parcels/CDH-5.12.2-1.cdh5.12.2.p0.4/lib/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/sql/compiler.py", line 786, in execute_sql
cursor.execute(sql, params)
File "/opt/cloudera/parcels/CDH-5.12.2-1.cdh5.12.2.p0.4/lib/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/backends/util.py", line 53, in execute
return self.cursor.execute(sql, params)
File "/opt/cloudera/parcels/CDH-5.12.2-1.cdh5.12.2.p0.4/lib/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/utils.py", line 99, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/opt/cloudera/parcels/CDH-5.12.2-1.cdh5.12.2.p0.4/lib/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/backends/util.py", line 53, in execute
return self.cursor.execute(sql, params)
File "/opt/cloudera/parcels/CDH-5.12.2-1.cdh5.12.2.p0.4/lib/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/backends/mysql/base.py", line 124, in execute
return self.cursor.execute(query, args)
File "/opt/cloudera/parcels/CDH-5.12.2-1.cdh5.12.2.p0.4/lib/hue/build/env/lib/python2.7/site-packages/MySQL_python-1.2.5-py2.7-linux-x86_64.egg/MySQLdb/cursors.py", line 205, in execute
self.errorhandler(self, exc, value)
File "/opt/cloudera/parcels/CDH-5.12.2-1.cdh5.12.2.p0.4/lib/hue/build/env/lib/python2.7/site-packages/MySQL_python-1.2.5-py2.7-linux-x86_64.egg/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
ProgrammingError: (1146, "Table 'hue.useradmin_userprofile' doesn't exist")
MariaDB [(none)]> use hue
MariaDB [hue]> show tables;
+--------------------------------+
| Tables_in_hue |
+--------------------------------+
| auth_group |
| auth_group_permissions |
| auth_permission |
| auth_user |
| auth_user_groups |
| auth_user_user_permissions |
| django_openid_auth_association |
| django_openid_auth_nonce |
+--------------------------------+
8 rows in set (0.00 sec)
# 对比正常启动的Hue服务,明显初始化创建的hue数据库的table少了很多,【还没有查到原因】
1. 删除数据库重建
MariaDB [hue]> drop database hue;
create database hue DEFAULT CHARACTER SET utf8mb4;
grant all on hue.* TO 'hue'@'%' IDENTIFIED BY 'hue';
2. 在cloudera中删除hue服务
cloudera 提示删除服务操作,不会删除主机上的服务数据,只会从cloudera manager的管理中删除此服务,系统将会从主机模板中删除此服务下的所有角色组。
3. 创建数据库,并授权
MariaDB [hue]> create database hue DEFAULT CHARACTER SET utf8mb4;
MariaDB [hue]> grant all on hue.* TO 'hue'@'%' IDENTIFIED BY 'hue';
4. 重新添加hue服务
如上步骤,重新操作一遍并没有解决问题,还是同样的错误出现