cdh5.3.6下hue3.7.0的安装部署

时间:2022-09-16 22:10:14

由于在CM5.7.0中执行HUE的hive workflow有问题,网上说是oozie仅支持0.13.1版本的hive,故搭建的集群暂时用不上,需要重新搭建一个伪分布式的cm,网上找到一篇,在下载下面的组件的时候,确实是有些版本限制,按下文走一遭试试!

帮的上忙的链接:http://suncf1985.iteye.com/blog/2012926!!!

本文介绍如何在centOS6.4环境下安装hue环境!

一、安装环境列表

centOS6.4

hue-3.7.0-cdh5.3.6

cdh5.3.6

jdk1.7.0_67

hadoop2.5.0

hive-0.13.1-cdh5.3.6

oozie-4.0.0-cdh5.3.6

下载地址:http://archive.cloudera.com/cdh5/cdh/5/

二、安装编译

    2.1 解压hue-3.7.0-cdh5.3.6

将上一步下载好的hue-3.7.0-cdh5.3.6解压到某一目录(如:/home/xusy/share/cdh5.3.6)


2.2 安装依赖包

sudo yum install ant asciidoc cyrus-sasl-devel cyrus-sasl-gssapi gcc gcc-c++ krb5-devel libtidy libxml2-devel libxslt-devel make mvn mysql mysql-devel openldap-devel python-devel sqlite-devel openssl-devel gmp-devel
cdh5.3.6下hue3.7.0的安装部署

P
S:安装依赖包之前,最好使用国内仓库,下载速度快些,而且也相对稳定。

     可以参考文章:http://blog.csdn.net/maomaosi2009/article/details/45646245


2.3 编译hue

make apps

cdh5.3.6下hue3.7.0的安装部署

编译完成后,如果多了以下两个文件,就证明已经编译成功,如果编译失败了,请检查上一步安装的依赖包有没      有失败的。

cdh5.3.6下hue3.7.0的安装部署


3、配置文件

在目录/home/xusy/share/cdh5.3.6/hue-3.7.0-cdh5.3.6/desktop/conf下有个hue.ini文件

修改如下地方:

  1. # Set this to a random string, the longer the better.  
  2. # This is used for secure hashing in the session store.  
  3. secret_key=jFE93j;2maomaosi22943d['d;/.q[eIW^y#e=+Iei*@  
  4.   
  5. # Webserver listens on this address and port  
  6. http_host=xuxudede.com  
  7. http_port=8888  
  8.   
  9. # Time zone name  
  10. time_zone=Asia/Shanghai  

注意:secret_key随便填写一个30-60个长度的字符串即可,如果不填写的话Hue会提示错误信息,这个secret_key主要是出于安全考虑用来存储在session store中进行安全验证的。时区修改成亚洲时区。

4、启动hue

build/env/bin/supervisor

cdh5.3.6下hue3.7.0的安装部署

注意:这个进程不能关掉,可以在后台启动。

     启动成功后,查看http://xuxudede.com:8888/网页显示

cdh5.3.6下hue3.7.0的安装部署

输入用户名密码后

cdh5.3.6下hue3.7.0的安装部署

至此,hue已经安装成功,就可以在上面集成hadoop、hive等了。

======================================================================================================

修改/hue/desktop/conf/hue.ini

hadoop_home等信息

注意端口号是否与hadoop上一致

例如默认hdfs_port=8020, 实际上hadoop上配置的为9000


运行hue

/usr/share/hue/build/env/bin/superviser
报错

  1. [root@localhost lib]# /usr/share/hue/build/env/bin/supervisor  
  2. Traceback (most recent call last):  
  3.   File "/usr/share/hue/build/env/bin/supervisor", line 8, in <module>  
  4.     load_entry_point('desktop==3.5.0', 'console_scripts', 'supervisor')()  
  5.   File "/usr/share/hue/desktop/core/src/desktop/supervisor.py", line 319, in main  
  6.     setup_user_info()  
  7.   File "/usr/share/hue/desktop/core/src/desktop/supervisor.py", line 257, in setup_user_info  
  8.     desktop.lib.daemon_utils.get_uid_gid(SETUID_USER, SETGID_GROUP)  
  9.   File "/usr/share/hue/desktop/core/src/desktop/lib/daemon_utils.py", line 45, in get_uid_gid  
  10.     raise KeyError("Couldn't get user id for user %s" % (username,))  
  11. KeyError: "Couldn't get user id for user hue"  


参考 https://github.com/cloudera/hue/issues/27   

adduser hue

  1. [root@localhost lib]# adduser hue  
  2. [root@localhost lib]# /usr/share/hue/build/env/bin/supervisor 又报错  
  3. /usr/share/hue/build/env/lib/python2.6/site-packages/Django-1.4.5-py2.6.egg/django/conf/__init__.py:110: DeprecationWarning: The SECRET_KEY setting must not be empty.  
  4.   warnings.warn("The SECRET_KEY setting must not be empty.", DeprecationWarning)  
  5. /usr/share/hue/build/env/lib/python2.6/site-packages/Django-1.4.5-py2.6.egg/django/conf/__init__.py:110: DeprecationWarning: The SECRET_KEY setting must not be empty.  
  6.   warnings.warn("The SECRET_KEY setting must not be empty.", DeprecationWarning)  
  7. /usr/share/hue/build/env/lib/python2.6/site-packages/Django-1.4.5-py2.6.egg/django/conf/__init__.py:110: DeprecationWarning: The SECRET_KEY setting must not be empty.  
  8.   warnings.warn("The SECRET_KEY setting must not be empty.", DeprecationWarning)  
  9. starting server with options {'ssl_certificate': None, 'workdir': None, 'server_name': 'localhost', 'host': '0.0.0.0', 'daemonize': False, 'threads': 10, 'pidfile': None, 'ssl_private_key': None, 'server_group': 'hue', 'ssl_cipher_list': 'DEFAULT:!aNULL:!eNULL:!LOW:!EXPORT:!SSLv2', 'port': 8888, 'server_user': 'hue'}  



The SECRET_KEY setting must not be empty

Specifying the Secret Key

For security, you should also specify the secret key that is used for secure hashing in the session store. Enter a long series of random characters (30 to 60 characters is recommended).

secret_key=jFE93j;2[290-eiw.KEiwN2s3['d;/.q[eIW^y#e=+Iei*@Mn<qW5o
cdh5.3.6下hue3.7.0的安装部署  

If you don’t specify a secret key, your session cookies will not be secure. Hue will run but it will also display error messages telling you to set the secret key.



完善各种配置

在core-site.xml 配置


<property>
  <name>hadoop.tmp.dir</name>
  <value>/tmp/hadoop-${user.name}${hue.suffix}</value>
</property>

由于已经安装hive需在hue.ini中指定变量

  # Hive configuration directory, where hive-site.xml is located
  ## hive_conf_dir=/etc/hive/conf
hive_conf_dir=/opt/hadoop/hive-0.10.0-bin/conf

启动  /usr/share/hue/build/env/bin/supervisor
command line里显示正常
  1. [root@localhost desktop]# /usr/share/hue/build/env/bin/supervisor  
  2. starting server with options {'ssl_certificate': None, 'workdir': None, 'server_name': 'localhost', 'host': '127.0.0.1', 'daemonize': False, 'threads': 10, 'pidfile': None, 'ssl_private_key': None, 'server_group': 'hue', 'ssl_cipher_list': 'DEFAULT:!aNULL:!eNULL:!LOW:!EXPORT:!SSLv2', 'port': 8888, 'server_user': 'hue'}  
  3. /usr/share/hue/build/env/lib/python2.6/site-packages/Django-1.4.5-py2.6.egg/django/views/generic/simple.py:8: DeprecationWarning: Function-based generic views have been deprecated; use class-based views instead.  
  4.   DeprecationWarning  


但是http://localhost:8888/accounts/login/?next=/ 进入出现报错信息

  1. [25/Feb/2014 01:32:08 +0000] middleware   INFO     Redirecting to login page: /  
  2. [25/Feb/2014 01:32:08 +0000] access       INFO     127.0.0.1 -anon- - "GET / HTTP/1.1" -- login redirection  
  3. [25/Feb/2014 01:32:09 +0000] base         ERROR    Internal Server Error: /accounts/login/  
  4. Traceback (most recent call last):  
  5.   File "/usr/share/hue/build/env/lib/python2.6/site-packages/Django-1.4.5-py2.6.egg/django/core/handlers/base.py", line 188, in get_response  
  6.     response = middleware_method(request, response)  
  7.   File "/usr/share/hue/build/env/lib/python2.6/site-packages/Django-1.4.5-py2.6.egg/django/contrib/sessions/middleware.py", line 36, in process_response  
  8.     request.session.save()  
  9.   File "/usr/share/hue/build/env/lib/python2.6/site-packages/Django-1.4.5-py2.6.egg/django/contrib/sessions/backends/db.py", line 58, in save  
  10.     obj.save(force_insert=must_create, using=using)  
  11.   File "/usr/share/hue/build/env/lib/python2.6/site-packages/Django-1.4.5-py2.6.egg/django/db/models/base.py", line 463, in save  
  12.     self.save_base(using=using, force_insert=force_insert, force_update=force_update)  
  13.   File "/usr/share/hue/build/env/lib/python2.6/site-packages/Django-1.4.5-py2.6.egg/django/db/models/base.py", line 551, in save_base  
  14.     result = manager._insert([self], fields=fields, return_id=update_pk, using=using, raw=raw)  
  15.   File "/usr/share/hue/build/env/lib/python2.6/site-packages/Django-1.4.5-py2.6.egg/django/db/models/manager.py", line 203, in _insert  
  16.     return insert_query(self.model, objs, fields, **kwargs)  
  17.   File "/usr/share/hue/build/env/lib/python2.6/site-packages/Django-1.4.5-py2.6.egg/django/db/models/query.py", line 1593, in insert_query  
  18.     return query.get_compiler(using=using).execute_sql(return_id)  
  19.   File "/usr/share/hue/build/env/lib/python2.6/site-packages/Django-1.4.5-py2.6.egg/django/db/models/sql/compiler.py", line 912, in execute_sql  
  20.     cursor.execute(sql, params)  
  21.   File "/usr/share/hue/build/env/lib/python2.6/site-packages/Django-1.4.5-py2.6.egg/django/db/backends/sqlite3/base.py", line 344, in execute  
  22.     return Database.Cursor.execute(self, query, params)  
  23. DatabaseError: attempt to write a readonly database  

原因是 /usr/share/hue/desktop/desktop.db  对root用户权限777但对其它用户:hue只有读的权限

chmod o+w desktop.db

又报错

  1. [25/Feb/2014 01:33:26 +0000] base         ERROR    Internal Server Error: /accounts/login/  
  2. Traceback (most recent call last):  
  3.   File "/usr/share/hue/build/env/lib/python2.6/site-packages/Django-1.4.5-py2.6.egg/django/core/handlers/base.py", line 188, in get_response  
  4.     response = middleware_method(request, response)  
  5.   File "/usr/share/hue/build/env/lib/python2.6/site-packages/Django-1.4.5-py2.6.egg/django/contrib/sessions/middleware.py", line 36, in process_response  
  6.     request.session.save()  
  7.   File "/usr/share/hue/build/env/lib/python2.6/site-packages/Django-1.4.5-py2.6.egg/django/contrib/sessions/backends/db.py", line 58, in save  
  8.     obj.save(force_insert=must_create, using=using)  
  9.   File "/usr/share/hue/build/env/lib/python2.6/site-packages/Django-1.4.5-py2.6.egg/django/db/models/base.py", line 463, in save  
  10.     self.save_base(using=using, force_insert=force_insert, force_update=force_update)  
  11.   File "/usr/share/hue/build/env/lib/python2.6/site-packages/Django-1.4.5-py2.6.egg/django/db/models/base.py", line 551, in save_base  
  12.     result = manager._insert([self], fields=fields, return_id=update_pk, using=using, raw=raw)  
  13.   File "/usr/share/hue/build/env/lib/python2.6/site-packages/Django-1.4.5-py2.6.egg/django/db/models/manager.py", line 203, in _insert  
  14.     return insert_query(self.model, objs, fields, **kwargs)  
  15.   File "/usr/share/hue/build/env/lib/python2.6/site-packages/Django-1.4.5-py2.6.egg/django/db/models/query.py", line 1593, in insert_query  
  16.     return query.get_compiler(using=using).execute_sql(return_id)  
  17.   File "/usr/share/hue/build/env/lib/python2.6/site-packages/Django-1.4.5-py2.6.egg/django/db/models/sql/compiler.py", line 912, in execute_sql  
  18.     cursor.execute(sql, params)  
  19.   File "/usr/share/hue/build/env/lib/python2.6/site-packages/Django-1.4.5-py2.6.egg/django/db/backends/sqlite3/base.py", line 344, in execute  
  20.     return Database.Cursor.execute(self, query, params)  
  21. DatabaseError: unable to open database file  

原因是包含desktop.db的文件夹对hue用户也是只能读不能写的

干脆把这个hue文件所属用户和组都给hue

chown chown -R hue.hue /usr/share/hue

再启动 完美运行 


注意:

若提示

Resource Manager Failed to contact Resource Manager at http://localhost:8088/ws/v1:。。。

原因是 hue.ini 中同时配置了 [[yarn_clusters]] 和 [[mapred_clusters]] 中的 

  # Whether to submit jobs to this cluster
      submit_to=true

两者只能选一,MR1就选后者MR2选 [[yarn_clusters]]