分享

Hadoop可视化分析利器之Hue

 啊司com 2016-12-06

先来看下hue的架构图: 

(1)Hue是什么? 
Hue是一个可快速开发和调试Hadoop生态系统各种应用的一个基于浏览器的图形化用户接口。 
(2)Hue能干什么? 
1,访问HDFS和文件浏览 
2,通过web调试和开发hive以及数据结果展示 
3,查询solr和结果展示,报表生成 
4,通过web调试和开发impala交互式SQL Query 
5,spark调试和开发 
6,Pig开发和调试 
7,oozie任务的开发,监控,和工作流协调调度 
8,Hbase数据查询和修改,数据展示 
9,Hive的元数据(metastore)查询 
10,MapReduce任务进度查看,日志追踪 
11,创建和提交MapReduce,Streaming,Java job任务 
12,Sqoop2的开发和调试 
13,Zookeeper的浏览和编辑 
14,数据库(MySQL,PostGres,SQlite,Oracle)的查询和展示 
(3)Hue怎么用或者什么时候应该用? 
如果你们公司用的是CDH的hadoop,那么很幸运,Hue也是出自CDH公司,自家的东西用起来当然很爽。 
如果你们公司用的是Apache Hadoop或者是HDP的hadoop,那么也没事,Hue是开源的,而且支持任何版本的hadoop。 
关于什么时候用,这纯属一个锦上添花的功能,你完全可以不用hue,因为各种开源项目都有自己的使用方式和开发接口,hue只不过是统一了各个项目的开发方式在一个接口里而已,这样比较方便而已,不用你一会准备使用hive,就开一个hive的cli终端,一会用pig,你就得开一个pig的grunt,或者你又想查Hbase,又得需要开一个Hbase的shell终端。如果你们使用hadoop生态系统的组件很多的情况下,使用hue还是比较方便的,另外一个好处就是hue提供了一个web的界面来开发和调试任务,不用我们再频繁登陆Linux来操作了。 
你可以在任何时候,只要能上网,就可以通过hue来开发和调试数据,不用再装Linux的客户端来远程登陆操作了,这也是B/S架构的好处。 
(4)如何下载,安装和编译Hue? 
CentOS系统,执行命令: 
yum install -y asciidoc cyrus-sasl-devel cyrus-sasl-gssapi gcc gcc-c++ krb5-devel  libtidy  libxml2-devel libxslt-devel make mysql mysql-devel openldap-devel python-devel  sqlite-devel openssl-devel  gmp-devel 
1,hue的依赖(centos系统) 

  1. ant 
  2. asciidoc 
  3. cyrus-sasl-devel 
  4. cyrus-sasl-gssapi 
  5. gcc 
  6. gcc-c++ 
  7. krb5-devel 
  8. libtidy (for unit tests only) 
  9. libxml2-devel 
  10. libxslt-devel 
  11. make 
  12. mvn (from maven package or maven3 tarball) 
  13. mysql 
  14. mysql-devel 
  15. openldap-devel 
  16. python-devel 
  17. sqlite-devel 
  18. openssl-devel (for version 7+) 


2,散仙的在安装hue前,centos上已经安装好了,jdk,maven,ant,hadoop,hive,oozie等,环境变量如下:

Java代码 
  1. user='search' 
  2. # java 
  3. export JAVA_HOME='/usr/local/jdk' 
  4. export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib 
  5. export PATH=$PATH:$JAVA_HOME/bin 
  6. # ant   
  7. export ANT_HOME=/usr/local/ant 
  8. export CLASSPATH=$CLASSPATH:$ANT_HOME/lib 
  9. export PATH=$PATH:$ANT_HOME/bin 
  10. # maven   
  11. export MAVEN_HOME='/usr/local/maven' 
  12. export CLASSPATH=$CLASSPATH:$MAVEN_HOME/lib 
  13. export PATH=$PATH:$MAVEN_HOME/bin 
  14. ##Hadoop2.2的变量设置 
  15. export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin 
  16. export HADOOP_HOME=/home/search/hadoop 
  17. export HADOOP_MAPRED_HOME=$HADOOP_HOME 
  18. export HADOOP_COMMON_HOME=$HADOOP_HOME 
  19. export HADOOP_HDFS_HOME=$HADOOP_HOME 
  20. export YARN_HOME=$HADOOP_HOME 
  21. export HADOOP_CONF_DIR=$HADOOP_HOME/etc/hadoop 
  22. export YARN_CONF_DIR=$HADOOP_HOME/etc/hadoop 
  23. export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin 
  24. export CLASSPATH=.:$CLASSPATH:$HADOOP_COMMON_HOME:$HADOOP_COMMON_HOMEi/lib:$HADOOP_MAPRED_HOME:$HADOOP_HDFS_HOME:$HADOOP_HDFS_HOME 
  25. # Hive   
  26. export HIVE_HOME=/home/search/hive   
  27. export HIVE_CONF_DIR=/home/search/hive/conf   
  28. export CLASSPATH=$CLASSPATH:$HIVE_HOME/lib   
  29. export PATH=$PATH:$HIVE_HOME/bin:$HIVE_HOME/conf   
  30. export OOZIE_HOME='/home/search/oozie-4.1.0' 
  31. export PATH=$PATH:$OOZIE_HOME/sbin:$OOZIE_HOME/bin 


3,本文散仙主要是采用tar包的方式安装hue,除了tar包的方式,hue还能采用cm安装,当然这就与cdh的系统依赖比较大了。 
hue最新的版本是3.8.1,散仙这里用的3.7.0的版本 
下载地址:https://github.com/cloudera/hue/releases 
hue的github地址:https://github.com/cloudera/hue 
4,下载完后,解压tar包,并进入hue的根目录执行命令 
make apps编译 
5,编译成功后,需要配置/home/search/hue/desktop/conf/pseudo-distributed.ini文件,里面包含了hdfs,yarn,mapreduce,hive,oozie,pig,spark,solr等的ip地址和端口号配置,可根据自己的情况设置,如果没有安装某个应用,那就无须配置,只不过这个应用在web上不能使用而已,并不会影响其他框架的使用。 
一个例子如下: 

Java代码 
  1. ##################################### 
  2. # DEVELOPMENT EDITION 
  3. ##################################### 
  4. # Hue configuration file 
  5. # =================================== 
  6. # For complete documentation about the contents of this file, run 
  7. #       $ /build/env/bin/hue config_help 
  8. # All .ini files under the current directory are treated equally.  Their 
  9. # contents are merged to form the Hue configuration, which can 
  10. # can be viewed on the Hue at 
  11. #       http://:/dump_config 
  12. ########################################################################### 
  13. # General configuration for core Desktop features (authentication, etc) 
  14. ########################################################################### 
  15. [desktop] 
  16.   send_dbug_messages=
  17.   # To show database transactions, set database_logging to 
  18.   database_logging=
  19.   # Set this to a random string, the longer the better. 
  20.   # This is used for secure hashing in the session store. 
  21.   secret_key=search 
  22.   # Webserver listens on this address and port 
  23.   http_host=0.0.0.0 
  24.   http_port=8000 
  25.   # Time zone name 
  26.   time_zone=Asia/Shanghai 
  27.   # Enable or disable Django debug mode 
  28.   ## django_debug_mode=true 
  29.   # Enable or disable backtrace for server error 
  30.   ## http_500_debug_mode=true 
  31.   # Enable or disable memory profiling. 
  32.   ## memory_profiler=false 
  33.   # Server email for internal error messages 
  34.   ## django_server_email='hue@localhost.localdomain' 
  35.   # Email backend 
  36.   ## django_email_backend=django.core.mail.backends.smtp.EmailBackend 
  37.   # Webserver runs as this user 
  38.   server_user=search 
  39.   server_group=search 
  40.   # This should be the Hue admin and proxy user 
  41.   default_user=search 
  42.   # This should be the hadoop cluster admin 
  43.   default_hdfs_superuser=search 
  44.   # If set to false, runcpserver will not actually start the web server. 
  45.   # Used if Apache is being used as a WSGI container. 
  46.   ## enable_server=yes 
  47.   # Number of threads used by the CherryPy web server 
  48.   ## cherrypy_server_threads=10 
  49.   # Filename of SSL Certificate 
  50.   ## ssl_certificate= 
  51.   # Filename of SSL RSA Private Key 
  52.   ## ssl_private_key= 
  53.   # List of allowed and disallowed ciphers in cipher list format. 
  54.   # See http://www.openssl.org/docs/apps/ciphers.html for more information on cipher list format. 
  55.   ## ssl_cipher_list=DEFAULT:!aNULL:!eNULL:!LOW:!EXPORT:!SSLv2 
  56.   # LDAP username and password of the hue user used for LDAP authentications. 
  57.   # Set it to use LDAP Authentication with HiveServer2 and Impala. 
  58.   ## ldap_username=hue 
  59.   ## ldap_password= 
  60.   # Default encoding for site data 
  61.   ## default_site_encoding=utf-
  62.   # Help improve Hue with anonymous usage analytics. 
  63.   # Use Google Analytics to see how many times an application or specific section of an application is used, nothing more. 
  64.   ## collect_usage=true 
  65.   # Support for HTTPS termination at the load-balancer level with SECURE_PROXY_SSL_HEADER. 
  66.   ## secure_proxy_ssl_header=false 
  67.   # Comma-separated list of Django middleware classes to use. 
  68.   # See https://docs.djangoproject.com/en/1.4/ref/middleware/ for more details on middlewares in Django. 
  69.   ## middleware=desktop.auth.backend.LdapSynchronizationBackend 
  70.   # Comma-separated list of regular s, which match the redirect URL. 
  71.   # For example, to restrict to your local domain and FQDN, the following value can be used: 
  72.   # ^\/.*$,^http:\/\/www.mydomain.com\/.*$ 
  73.   ## redirect_whitelist= 
  74.   # Comma separated list of apps to not load at server startup. 
  75.   # e.g.: pig,zookeeper 
  76.   ## app_blacklist= 
  77.   # The directory where to store the auditing logs. Auditing is disable if the value is empty. 
  78.   # e.g. /var/log/hue/audit.log 
  79.   ## audit_event_log_dir= 
  80.   # Size in KB/MB/GB for audit log to rollover. 
  81.   ## audit_log_max_file_size=100MB 
  82. #poll_enabled=false 
  83.   # Administrators 
  84.   # ---------------- 
  85.   [[django_admins]] 
  86.     ## [[[admin1]]] 
  87.     ## name=john 
  88.     ## email=john@doe.com 
  89.   # UI customizations 
  90.   # ------------------- 
  91.   [[custom]] 
  92.   # Top banner HTML code 
  93.   #banner_top_html=Search Team Hadoop Manager 
  94.   # Configuration options for user authentication into the web application 
  95.   # ------------------------------------------------------------------------ 
  96.   [[auth]] 
  97.     # Authentication backend. Common settings are: 
  98.     # - django.contrib.auth.backends.ModelBackend (entirely Django backend) 
  99.     # - desktop.auth.backend.AllowAllBackend (allows everyone) 
  100.     # - desktop.auth.backend.AllowFirstUserDjangoBackend 
  101.     #     (Default. Relies on Django and user manager, after the first login) 
  102.     # - desktop.auth.backend.LdapBackend 
  103.     # - desktop.auth.backend.PamBackend 
  104.     # - desktop.auth.backend.SpnegoDjangoBackend 
  105.     # - desktop.auth.backend.RemoteUserDjangoBackend 
  106.     # - libsaml.backend.SAML2Backend 
  107.     # - libopenid.backend.OpenIDBackend 
  108.     # - liboauth.backend.OAuthBackend 
  109.     #     (New oauth, support Twitter, Facebook, Google+ and Linkedin 
  110.     ## backend=desktop.auth.backend.AllowFirstUserDjangoBackend 
  111.     # The service to use when querying PAM. 
  112.     ## pam_service=login 
  113.     # When using the desktop.auth.backend.RemoteUserDjangoBackend, this sets 
  114.     # the normalized name of the header that contains the remote user. 
  115.     # The HTTP header in the request is converted to a key by converting 
  116.     # all characters to uppercase, replacing any hyphens with underscores 
  117.     # and adding an HTTP_ prefix to the name. So, for example, if the header 
  118.     # is called Remote-User that would be configured as HTTP_REMOTE_USER 
  119.     # 
  120.     # Defaults to HTTP_REMOTE_USER 
  121.     ## remote_user_header=HTTP_REMOTE_USER 
  122.     # Ignore the case of usernames when searching for existing users. 
  123.     # Only supported in remoteUserDjangoBackend. 
  124.     ## ignore_username_case=false 
  125.     # Ignore the case of usernames when searching for existing users to authenticate with. 
  126.     # Only supported in remoteUserDjangoBackend. 
  127.     ## force_username_lowercase=false 
  128.     # Users will expire after they have not logged in for 'n' amount of seconds. 
  129.     # A negative number means that users will never expire. 
  130.     ## expires_after=-
  131.     # Apply 'expires_after' to superusers. 
  132.     ## expire_superusers=true 
  133.   # Configuration options for connecting to LDAP and Active Directory 
  134.   # ------------------------------------------------------------------- 
  135.   [[ldap]] 
  136.     # The search base for finding users and groups 
  137.     ## base_dn='DC=mycompany,DC=com' 
  138.     # URL of the LDAP server 
  139.     ## ldap_url=ldap://auth.mycompany.com 
  140.     # A PEM-format file containing certificates for the CA's that 
  141.     # Hue will trust for authentication over TLS. 
  142.     # The certificate for the CA that signed the 
  143.     # LDAP server certificate must be included among these certificates. 
  144.     # See more here http://www.openldap.org/doc/admin24/tls.html. 
  145.     ## ldap_cert= 
  146.     ## use_start_tls=true 
  147.     # Distinguished name of the user to bind as -- not necessary if the LDAP server 
  148.     # supports anonymous searches 
  149.     ## bind_dn='CN=ServiceAccount,DC=mycompany,DC=com' 
  150.     # Password of the bind user -- not necessary if the LDAP server supports 
  151.     # anonymous searches 
  152.     ## bind_password= 
  153.     # Pattern for searching for usernames -- Use  for the parameter 
  154.     # For use when using LdapBackend for Hue authentication 
  155.     ## ldap_username_pattern='uid=,ou=People,dc=mycompany,dc=com' 
  156.     # Create users in Hue when they try to login with their LDAP credentials 
  157.     # For use when using LdapBackend for Hue authentication 
  158.     ## create_users_on_login = true 
  159.     # Synchronize a users groups when they login 
  160.     ## sync_groups_on_login=false 
  161.     # Ignore the case of usernames when searching for existing users in Hue. 
  162.     ## ignore_username_case=false 
  163.     # Force usernames to lowercase when creating new users from LDAP. 
  164.     ## force_username_lowercase=false 
  165.     # Use search bind authentication. 
  166.     ## search_bind_authentication=true 
  167.     # Choose which kind of subgrouping to use: nested or suboordinate (deprecated). 
  168.     ## subgroups=suboordinate 
  169.     # Define the number of levels to search for nested members. 
  170.     ## nested_members_search_depth=10 
  171.     [[[users]]] 
  172.       # Base filter for searching for users 
  173.       ## user_filter='objectclass=*' 
  174.       # The username attribute in the LDAP schema 
  175.       ## user_name_attr=sAMAccountName 
  176.     [[[groups]]] 
  177.       # Base filter for searching for groups 
  178.       ## group_filter='objectclass=*' 
  179.       # The username attribute in the LDAP schema 
  180.       ## group_name_attr=cn 
  181.     [[[ldap_servers]]] 
  182.       ## [[[[mycompany]]]] 
  183.         # The search base for finding users and groups 
  184.         ## base_dn='DC=mycompany,DC=com' 
  185.         # URL of the LDAP server 
  186.         ## ldap_url=ldap://auth.mycompany.com 
  187.         # A PEM-format file containing certificates for the CA's that 
  188.         # Hue will trust for authentication over TLS. 
  189.         # The certificate for the CA that signed the 
  190.         # LDAP server certificate must be included among these certificates. 
  191.         # See more here http://www.openldap.org/doc/admin24/tls.html. 
  192.         ## ldap_cert= 
  193.         ## use_start_tls=true 
  194.         # Distinguished name of the user to bind as -- not necessary if the LDAP server 
  195.         # supports anonymous searches 
  196.         ## bind_dn='CN=ServiceAccount,DC=mycompany,DC=com' 
  197.         # Password of the bind user -- not necessary if the LDAP server supports 
  198.         # anonymous searches 
  199.         ## bind_password= 
  200.         # Pattern for searching for usernames -- Use  for the parameter 
  201.         # For use when using LdapBackend for Hue authentication 
  202.         ## ldap_username_pattern='uid=,ou=People,dc=mycompany,dc=com' 
  203.         ## Use search bind authentication. 
  204.         ## search_bind_authentication=true 
  205.         ## [[[[[users]]]]] 
  206.           # Base filter for searching for users 
  207.           ## user_filter='objectclass=Person' 
  208.           # The username attribute in the LDAP schema 
  209.           ## user_name_attr=sAMAccountName 
  210.         ## [[[[[groups]]]]] 
  211.           # Base filter for searching for groups 
  212.           ## group_filter='objectclass=groupOfNames' 
  213.           # The username attribute in the LDAP schema 
  214.           ## group_name_attr=cn 
  215.   # Configuration options for specifying the Desktop Database. For more info, 
  216.   # see http://docs.djangoproject.com/en/1.4/ref/settings/#database-engine 
  217.   # ------------------------------------------------------------------------ 
  218.   [[database]] 
  219.     # Database engine is typically one of: 
  220.     # postgresql_psycopg2, mysql, sqlite3 or oracle. 
  221.     # 
  222.     # Note that for sqlite3, 'name', below is a a path to the filename. For other backends, it is the database name. 
  223.     # Note for Oracle, options={'threaded':true} must be set in order to avoid crashes. 
  224.     # Note for Oracle, you can use the Oracle Service Name by setting 'port=0' and then 'name=:/'. 
  225.     ## engine=sqlite3 
  226.     ## host= 
  227.     ## port= 
  228.     ## user= 
  229.     ## password= 
  230.     ## name=desktop/desktop.db 
  231.     ## options={} 
  232.   # Configuration options for specifying the Desktop session. 
  233.   # For more info, see https://docs.djangoproject.com/en/1.4/topics/http/sessions/ 
  234.   # ------------------------------------------------------------------------ 
  235.   [[session]] 
  236.     # The cookie containing the users' session ID will expire after this amount of time in seconds. 
  237.     # Default is 2 weeks. 
  238.     ## ttl=1209600 
  239.     # The cookie containing the users' session ID will be secure. 
  240.     # Should only be enabled with HTTPS. 
  241.     ## secure=false 
  242.     # The cookie containing the users' session ID will use the HTTP only flag. 
  243.     ## http_only=false 
  244.     # Use session-length cookies. Logs out the user when she closes the browser window. 
  245.     ## expire_at_browser_close=false 
  246.   # Configuration options for connecting to an external SMTP server 
  247.   # ------------------------------------------------------------------------ 
  248.   [[smtp]] 
  249.     # The SMTP server information for email notification delivery 
  250.     host=localhost 
  251.     port=25 
  252.     user= 
  253.     password= 
  254.     # Whether to use a TLS (secure) connection when talking to the SMTP server 
  255.     tls=no 
  256.     # Default email address to use for various automated notification from Hue 
  257.     ## default_from_email=hue@localhost 
  258.   # Configuration options for Kerberos integration for secured Hadoop clusters 
  259.   # ------------------------------------------------------------------------ 
  260.   [[kerberos]] 
  261.     # Path to Hue's Kerberos keytab file 
  262.     ## hue_keytab= 
  263.     # Kerberos principal name for Hue 
  264.     ## hue_principal=hue/hostname.foo.com 
  265.     # Path to kinit 
  266.     ## kinit_path=/path/to/kinit 
  267.   # Configuration options for using OAuthBackend (Core) login 
  268.   # ------------------------------------------------------------------------ 
  269.   [[oauth]] 
  270.     # The Consumer key of the application 
  271.     ## consumer_key=XXXXXXXXXXXXXXXXXXXXX 
  272.     # The Consumer secret of the application 
  273.     ## consumer_secret=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 
  274.     # The Request token URL 
  275.     ## request_token_url=https://api.twitter.com/oauth/request_token 
  276.     # The Access token URL 
  277.     ## access_token_url=https://api.twitter.com/oauth/access_token 
  278.     # The Authorize URL 
  279.     ## authenticate_url=https://api.twitter.com/oauth/authorize 
  280. ########################################################################### 
  281. # Settings to configure SAML 
  282. ########################################################################### 
  283. [libsaml] 
  284.   # Xmlsec1 binary path. This program should be executable by the user running Hue. 
  285.   ## xmlsec_binary=/usr/local/bin/xmlsec1 
  286.   # Entity ID for Hue acting as service provider. 
  287.   # Can also accept a pattern where '' will be replaced with server URL base. 
  288.   ## entity_id='/saml2/metadata/' 
  289.   # Create users from SSO on login. 
  290.   ## create_users_on_login=true 
  291.   # Required attributes to ask for from IdP. 
  292.   # This requires a comma separated list. 
  293.   ## required_attributes=uid 
  294.   # Optional attributes to ask for from IdP. 
  295.   # This requires a comma separated list. 
  296.   ## optional_attributes= 
  297.   # IdP metadata in the form of a file. This is generally an XML file containing metadata that the Identity Provider generates. 
  298.   ## metadata_file= 
  299.   # Private key to encrypt metadata with. 
  300.   ## key_file= 
  301.   # Signed certificate to send along with encrypted metadata. 
  302.   ## cert_file= 
  303.   # A mapping from attributes in the response from the IdP to django user attributes. 
  304.   ## user_attribute_mapping={'uid':'username'} 
  305.   # Have Hue initiated authn requests be signed and provide a certificate. 
  306.   ## authn_requests_signed=false 
  307.   # Have Hue initiated logout requests be signed and provide a certificate. 
  308.   ## logout_requests_signed=false 
  309.   # Username can be sourced from 'attributes' or 'nameid'. 
  310.   ## username_source=attributes 
  311.   # Performs the logout or not. 
  312.   ## logout_enabled=true 
  313. ########################################################################### 
  314. # Settings to configure OpenId 
  315. ########################################################################### 
  316. [libopenid] 
  317.   # (Required) OpenId SSO endpoint url. 
  318.   ## server_endpoint_url=https://www.google.com/accounts/o8/id 
  319.   # OpenId 1.1 identity url prefix to be used instead of SSO endpoint url 
  320.   # This is only supported if you are using an OpenId 1.1 endpoint 
  321.   ## identity_url_prefix=https://app.onelogin.com/openid/your_company.com/ 
  322.   # Create users from OPENID on login. 
  323.   ## create_users_on_login=true 
  324.   # Use email for username 
  325.   ## use_email_for_username=true 
  326. ########################################################################### 
  327. # Settings to configure OAuth 
  328. ########################################################################### 
  329. [liboauth] 
  330.   # NOTE: 
  331.   # To work, each of the active (i.e. uncommented) service must have 
  332.   # applications created on the social network. 
  333.   # Then the 'consumer key' and 'consumer secret' must be provided here. 
  334.   # 
  335.   # The addresses where to do so are: 
  336.   # Twitter:  https://dev.twitter.com/apps 
  337.   # Google+ : https://cloud.google.com/ 
  338.   # Facebook: https://developers.facebook.com/apps 
  339.   # Linkedin: https://www.linkedin.com/secure/developer 
  340.   # 
  341.   # Additionnaly, the following must be set in the application settings: 
  342.   # Twitter:  Callback URL (aka Redirect URL) must be set to http://YOUR_HUE_IP_OR_DOMAIN_NAME/oauth/social_login/oauth_authenticated 
  343.   # Google+ : CONSENT SCREEN must have email address 
  344.   # Facebook: Sandbox Mode must be DISABLED 
  345.   # Linkedin: 'In OAuth User Agreement', r_emailaddress is REQUIRED 
  346.   # The Consumer key of the application 
  347.   ## consumer_key_twitter= 
  348.   ## consumer_key_google= 
  349.   ## consumer_key_facebook= 
  350.   ## consumer_key_linkedin= 
  351.   # The Consumer secret of the application 
  352.   ## consumer_secret_twitter= 
  353.   ## consumer_secret_google= 
  354.   ## consumer_secret_facebook= 
  355.   ## consumer_secret_linkedin= 
  356.   # The Request token URL 
  357.   ## request_token_url_twitter=https://api.twitter.com/oauth/request_token 
  358.   ## request_token_url_google=https://accounts.google.com/o/oauth2/auth 
  359.   ## request_token_url_linkedin=https://www.linkedin.com/uas/oauth2/authorization 
  360.   ## request_token_url_facebook=https://graph.facebook.com/oauth/authorize 
  361.   # The Access token URL 
  362.   ## access_token_url_twitter=https://api.twitter.com/oauth/access_token 
  363.   ## access_token_url_google=https://accounts.google.com/o/oauth2/token 
  364.   ## access_token_url_facebook=https://graph.facebook.com/oauth/access_token 
  365.   ## access_token_url_linkedin=https://api.linkedin.com/uas/oauth2/accessToken 
  366.   # The Authenticate URL 
  367.   ## authenticate_url_twitter=https://api.twitter.com/oauth/authorize 
  368.   ## authenticate_url_google=https://www.googleapis.com/oauth2/v1/userinfo?access_token= 
  369.   ## authenticate_url_facebook=https://graph.facebook.com/me?access_token= 
  370.   ## authenticate_url_linkedin=https://api.linkedin.com/v1/people/~:(email-address)?format=json&oauth2_access_token= 
  371.   # Username Map. Json Hash format. 
  372.   # Replaces username parts in order to simplify usernames obtained 
  373.   # Example: {'@sub1.domain.com':'_S1', '@sub2.domain.com':'_S2'} 
  374.   # converts 'email@sub1.domain.com' to 'email_S1' 
  375.   ## username_map={} 
  376.   # Whitelisted domains (only applies to Google OAuth). CSV format. 
  377.   ## whitelisted_domains_google= 
  378. ########################################################################### 
  379. # Settings for the RDBMS application 
  380. ########################################################################### 
  381. [librdbms] 
  382.   # The RDBMS app can have any number of databases configured in the databases 
  383.   # section. A database is known by its section name 
  384.   # (IE sqlite, mysql, psql, and oracle in the list below). 
  385.   [[databases]] 
  386.     # sqlite configuration. 
  387.     ## [[[sqlite]]] 
  388.       # Name to show in the UI. 
  389.       ## nice_name=SQLite 
  390.       # For SQLite, name defines the path to the database. 
  391.       ## name=/tmp/sqlite.db 
  392.       # Database backend to use. 
  393.       ## engine=sqlite 
  394.       # Database options to send to the server when connecting. 
  395.       # https://docs.djangoproject.com/en/1.4/ref/databases/ 
  396.       ## options={} 
  397.     # mysql, oracle, or postgresql configuration. 
  398.     ## [[[mysql]]] 
  399.       # Name to show in the UI. 
  400.       ## nice_name='My SQL DB' 
  401.       # For MySQL and PostgreSQL, name is the name of the database. 
  402.       # For Oracle, Name is instance of the Oracle server. For express edition 
  403.       # this is 'xe' by default. 
  404.       ## name=mysqldb 
  405.       # Database backend to use. This can be: 
  406.       # 1. mysql 
  407.       # 2. postgresql 
  408.       # 3. oracle 
  409.       ## engine=mysql 
  410.       # IP or hostname of the database to connect to. 
  411.       ## host=localhost 
  412.       # Port the database server is listening to. Defaults are: 
  413.       # 1. MySQL: 3306 
  414.       # 2. PostgreSQL: 5432 
  415.       # 3. Oracle Express Edition: 1521 
  416.       ## port=3306 
  417.       # Username to authenticate with when connecting to the database. 
  418.       ## user=example 
  419.       # Password matching the username to authenticate with when 
  420.       # connecting to the database. 
  421.       ## password=example 
  422.       # Database options to send to the server when connecting. 
  423.       # https://docs.djangoproject.com/en/1.4/ref/databases/ 
  424.       ## options={} 
  425. ########################################################################### 
  426. # Settings to configure your Hadoop cluster. 
  427. ########################################################################### 
  428. [hadoop] 
  429.   # Configuration for HDFS NameNode 
  430.   # ------------------------------------------------------------------------ 
  431.   [[hdfs_clusters]] 
  432.     # HA support by using HttpFs 
  433.     [[[default]]] 
  434.       # Enter the filesystem uri 
  435.       fs_defaultfs=hdfs://h1:8020 
  436.       # NameNode logical name. 
  437.       logical_name=h1 
  438.       # Use WebHdfs/HttpFs as the communication mechanism. 
  439.       # Domain should be the NameNode or HttpFs host. 
  440.       # Default port is 14000 for HttpFs. 
  441.       webhdfs_url=http://h1:50070/webhdfs/v1 
  442.       # Change this if your HDFS cluster is Kerberos-secured 
  443.       security_enabled=false 
  444.       # Default umask for file and directory creation, specified in an octal value. 
  445.       umask=022 
  446.       hadoop_conf_dir=/home/search/hadoop/etc/hadoop 
  447.   # Configuration for YARN (MR2) 
  448.   # ------------------------------------------------------------------------ 
  449.   [[yarn_clusters]] 
  450.     [[[default]]] 
  451.       # Enter the host on which you are running the ResourceManager 
  452.       resourcemanager_host=h1 
  453.       # The port where the ResourceManager IPC listens on 
  454.       resourcemanager_port=8032 
  455.       # Whether to submit jobs to this cluster 
  456.       submit_to=True 
  457.       # Resource Manager logical name (required for HA) 
  458.       ## logical_name= 
  459.       # Change this if your YARN cluster is Kerberos-secured 
  460.       ## security_enabled=false 
  461.       # URL of the ResourceManager API 
  462.       resourcemanager_api_url=http://h1:8088 
  463.       # URL of the ProxyServer API 
  464.       proxy_api_url=http://h1:8088 
  465.       # URL of the HistoryServer API 
  466.       history_server_api_url=http://h1:19888 
  467.     # HA support by specifying multiple clusters 
  468.     # e.g. 
  469.     # [[[ha]]] 
  470.       # Resource Manager logical name (required for HA) 
  471.       ## logical_name=my-rm-name 
  472.   # Configuration for MapReduce (MR1) 
  473.   # ------------------------------------------------------------------------ 
  474.   [[mapred_clusters]] 
  475.     [[[default]]] 
  476.       # Enter the host on which you are running the Hadoop JobTracker 
  477.      jobtracker_host=h1 
  478.       # The port where the JobTracker IPC listens on 
  479.      #jobtracker_port=8021 
  480.       # JobTracker logical name for HA 
  481.       ## logical_name= 
  482.       # Thrift plug-in port for the JobTracker 
  483.       ## thrift_port=9290 
  484.       # Whether to submit jobs to this cluster 
  485.       submit_to=False 
  486.       # Change this if your MapReduce cluster is Kerberos-secured 
  487.       ## security_enabled=false 
  488.     # HA support by specifying multiple clusters 
  489.     # e.g. 
  490.     # [[[ha]]] 
  491.       # Enter the logical name of the JobTrackers 
  492.       # logical_name=my-jt-name 
  493. ########################################################################### 
  494. # Settings to configure the Filebrowser app 
  495. ########################################################################### 
  496. [filebrowser] 
  497.   # Location on local filesystem where the uploaded archives are temporary stored. 
  498.   ## archive_upload_tempdir=/tmp 
  499. ########################################################################### 
  500. # Settings to configure liboozie 
  501. ########################################################################### 
  502. [liboozie] 
  503.   # The URL where the Oozie service runs on. This is required in order for 
  504.   # users to submit jobs. Empty value disables the config check. 
  505.   ## oozie_url=http://localhost:11000/oozie 
  506.   oozie_url=http://h1:11000/oozie 
  507.   # Requires FQDN in oozie_url if enabled 
  508.   ## security_enabled=false 
  509.   # Location on HDFS where the workflows/coordinator are deployed when submitted. 
  510.   remote_deployement_dir=/user/hue/oozie/deployments 
  511. ########################################################################### 
  512. # Settings to configure the Oozie app 
  513. ########################################################################### 
  514. [oozie] 
  515.   # Location on local FS where the examples are stored. 
  516.   local_data_dir=apps/oozie/examples/ 
  517.   # Location on local FS where the data for the examples is stored. 
  518.   ## sample_data_dir=...thirdparty/sample_data 
  519.   # Location on HDFS where the oozie examples and workflows are stored. 
  520.   remote_data_dir=apps/oozie/workspaces 
  521.   # Maximum of Oozie workflows or coodinators to retrieve in one API call. 
  522.   oozie_jobs_count=100 
  523.   # Use Cron format for defining the frequency of a Coordinator instead of the old frequency number/unit. 
  524.   ## enable_cron_scheduling=true 
  525.   enable_cron_scheduling=true 
  526. ########################################################################### 
  527. # Settings to configure Beeswax with Hive 
  528. ########################################################################### 
  529. [beeswax] 
  530.   # Host where HiveServer2 is running. 
  531.   # If Kerberos security is enabled, use fully-qualified domain name (FQDN). 
  532.   hive_server_host=h1 
  533.   # Port where HiveServer2 Thrift server runs on. 
  534.   hive_server_port=10000 
  535.   # Hive configuration directory, where hive-site.xml is located 
  536.   hive_conf_dir=/home/search/hive/conf 
  537.   # Timeout in seconds for thrift calls to Hive service 
  538.   server_conn_timeout=120 
  539.   # Set a LIMIT clause when browsing a partitioned table. 
  540.   # A positive value will be set as the LIMIT. If 0 or negative, do not set any limit. 
  541.   browse_partitioned_table_limit=250 
  542.   # A limit to the number of rows that can be downloaded from a query. 
  543.   # A value of -1 means there will be no limit. 
  544.   # A maximum of 65,000 is applied to XLS downloads. 
  545.   download_row_limit=1000000 
  546.   # Hue will try to close the Hive query when the user leaves the editor page. 
  547.   # This will free all the query resources in HiveServer2, but also make its results inaccessible. 
  548.   ## close_queries=false 
  549.   # Thrift version to use when communicating with HiveServer2 
  550.   ## thrift_version=
  551.   [[ssl]] 
  552.     # SSL communication enabled for this server. 
  553.     ## enabled=false 
  554.     # Path to Certificate Authority certificates. 
  555.     ## cacerts=/etc/hue/cacerts.pem 
  556.     # Path to the private key file. 
  557.     ## key=/etc/hue/key.pem 
  558.     # Path to the public certificate file. 
  559.     ## cert=/etc/hue/cert.pem 
  560.     # Choose whether Hue should validate certificates received from the server. 
  561.     ## validate=true 
  562. ########################################################################### 
  563. # Settings to configure Pig 
  564. ########################################################################### 
  565. [pig] 
  566.   # Location of piggybank.jar on local filesystem. 
  567.   local_sample_dir=/home/search/hue/apps/pig/examples 
  568.   # Location piggybank.jar will be copied to in HDFS. 
  569.   remote_data_dir=/home/search/pig/examples 
  570. ########################################################################### 
  571. # Settings to configure Sqoop 
  572. ########################################################################### 
  573. [sqoop] 
  574.   # For autocompletion, fill out the librdbms section. 
  575.   # Sqoop server URL 
  576.   server_url=http://h1:12000/sqoop 
  577. ########################################################################### 
  578. # Settings to configure Proxy 
  579. ########################################################################### 
  580. [proxy] 
  581.   # Comma-separated list of regular s, 
  582.   # which match 'host:port' of requested proxy target. 
  583.   ## whitelist=(localhost|127\.0\.0\.1):(50030|50070|50060|50075) 
  584.   # Comma-separated list of regular s, 
  585.   # which match any prefix of 'host:port/path' of requested proxy target. 
  586.   # This does not support matching GET parameters. 
  587.   ## blacklist= 
  588. ########################################################################### 
  589. # Settings to configure Impala 
  590. ########################################################################### 
  591. [impala] 
  592.   # Host of the Impala Server (one of the Impalad) 
  593.   ## server_host=localhost 
  594.   # Port of the Impala Server 
  595.   ## server_port=21050 
  596.   # Kerberos principal 
  597.   ## impala_principal=impala/hostname.foo.com 
  598.   # Turn on/off impersonation mechanism when talking to Impala 
  599.   ## impersonation_enabled=False 
  600.   # Number of initial rows of a result set to ask Impala to cache in order 
  601.   # to support re-fetching them for downloading them. 
  602.   # Set to for disabling the option and backward compatibility. 
  603.   ## querycache_rows=50000 
  604.   # Timeout in seconds for thrift calls 
  605.   ## server_conn_timeout=120 
  606.   # Hue will try to close the Impala query when the user leaves the editor page. 
  607.   # This will free all the query resources in Impala, but also make its results inaccessible. 
  608.   ## close_queries=true 
  609.   # If QUERY_TIMEOUT_S > 0, the query will be timed out (i.e. cancelled) if Impala does not do any work 
  610.   # (compute or send back results) for that query within QUERY_TIMEOUT_S seconds. 
  611.   ## query_timeout_s=600 
  612. ########################################################################### 
  613. # Settings to configure HBase Browser 
  614. ########################################################################### 
  615. [hbase] 
  616.   # Comma-separated list of HBase Thrift servers for clusters in the format of '(name|host:port)'. 
  617.   # Use full hostname with security. 
  618.   ## hbase_clusters=(Cluster|localhost:9090) 
  619.   # HBase configuration directory, where hbase-site.xml is located. 
  620.   ## hbase_conf_dir=/etc/hbase/conf 
  621.   # Hard limit of rows or columns per row fetched before truncating. 
  622.   ## truncate_limit = 500 
  623.   # 'buffered' is the default of the HBase Thrift Server and supports security. 
  624.   # 'framed' can be used to chunk up responses, 
  625.   # which is useful when used in conjunction with the nonblocking server in Thrift. 
  626.   ## thrift_transport=buffered 
  627. ########################################################################### 
  628. # Settings to configure Solr Search 
  629. ########################################################################### 
  630. [search] 
  631.   # URL of the Solr Server 
  632.   solr_url=http://172.21.50.41:8983/solr/ 
  633.   # Requires FQDN in solr_url if enabled 
  634.   ## security_enabled=false 
  635.   ## Query sent when no term is entered 
  636.   ## empty_query=*:* 
  637. ########################################################################### 
  638. # Settings to configure Solr Indexer 
  639. ########################################################################### 
  640. [indexer] 
  641.   # Location of the solrctl binary. 
  642.   ## solrctl_path=/usr/bin/solrctl 
  643.   # Location of the solr home. 
  644.   ## solr_home=/usr/lib/solr 
  645.   # Zookeeper ensemble. 
  646.   ## solr_zk_ensemble=localhost:2181/solr 
  647.   # The contents of this directory will be copied over to the solrctl host to its temporary directory. 
  648.   ## config_template_path=/../hue/desktop/libs/indexer/src/data/solr_configs 
  649. ########################################################################### 
  650. # Settings to configure Job Designer 
  651. ########################################################################### 
  652. [jobsub] 
  653.   # Location on local FS where examples and template are stored. 
  654.   ## local_data_dir=..../data 
  655.   # Location on local FS where sample data is stored 
  656.   ## sample_data_dir=...thirdparty/sample_data 
  657. ########################################################################### 
  658. # Settings to configure Job Browser 
  659. ########################################################################### 
  660. [jobbrowser] 
  661.   # Share submitted jobs information with all users. If set to false, 
  662.   # submitted jobs are visible only to the owner and administrators. 
  663.   ## share_jobs=true 
  664. ########################################################################### 
  665. # Settings to configure the Zookeeper application. 
  666. ########################################################################### 
  667. [zookeeper] 
  668.   [[clusters]] 
  669.     [[[default]]] 
  670.       # Zookeeper ensemble. Comma separated list of Host/Port. 
  671.       # e.g. localhost:2181,localhost:2182,localhost:2183 
  672.       host_ports=zk1:2181 
  673.       # The URL of the REST contrib service (required for znode browsing) 
  674.       ## rest_url=http://localhost:9998 
  675. ########################################################################### 
  676. # Settings to configure the Spark application. 
  677. ########################################################################### 
  678. [spark] 
  679.   # URL of the REST Spark Job Server. 
  680.   server_url=http://h1:8080/ 
  681. ########################################################################### 
  682. # Settings for the User Admin application 
  683. ########################################################################### 
  684. [useradmin] 
  685.   # The name of the default user group that users will be a member of 
  686.   ## default_user_group=default 
  687. ########################################################################### 
  688. # Settings for the Sentry lib 
  689. ########################################################################### 
  690. [libsentry] 
  691.   # Hostname or IP of server. 
  692.   ## hostname=localhost 
  693.   # Port the sentry service is running on. 
  694.   ## port=8038 
  695.   # Sentry configuration directory, where sentry-site.xml is located. 
  696.   ## sentry_conf_dir=/etc/sentry/conf 


编译好的目录如下: 

  1. -rw-rw-r--  1 search search  2782 5月  19 06:04 app.reg 
  2. -rw-rw-r--  1 search search  2782 5月  19 05:41 app.reg.bak 
  3. drwxrwxr-x 22 search search  4096 5月  20 01:05 apps 
  4. drwxrwxr-x  3 search search  4096 5月  19 05:41 build 
  5. drwxr-xr-x  2 search search  4096 5月  19 05:40 data 
  6. drwxrwxr-x  7 search search  4096 5月  20 01:29 desktop 
  7. drwxrwxr-x  2 search search  4096 5月  19 05:41 dist 
  8. drwxrwxr-x  7 search search  4096 5月  19 05:40 docs 
  9. drwxrwxr-x  3 search search  4096 5月  19 05:40 ext 
  10. -rw-rw-r--  1 search search 11358 5月  19 05:38 LICENSE.txt 
  11. drwxrwxr-x  2 search search  4096 5月  20 01:29 logs 
  12. -rw-rw-r--  1 search search  8121 5月  19 05:41 Makefile 
  13. -rw-rw-r--  1 search search  8505 5月  19 05:41 Makefile.sdk 
  14. -rw-rw-r--  1 search search  3093 5月  19 05:40 Makefile.tarball 
  15. -rw-rw-r--  1 search search  3498 5月  19 05:41 Makefile.vars 
  16. -rw-rw-r--  1 search search  2302 5月  19 05:41 Makefile.vars.priv 
  17. drwxrwxr-x  2 search search  4096 5月  19 05:41 maven 
  18. -rw-rw-r--  1 search search   801 5月  19 05:40 NOTICE.txt 
  19. -rw-rw-r--  1 search search  4733 5月  19 05:41 README.rst 
  20. -rw-rw-r--  1 search search    52 5月  19 05:38 start.sh 
  21. -rw-rw-r--  1 search search    65 5月  19 05:41 stop.sh 
  22. drwxrwxr-x  9 search search  4096 5月  19 05:38 tools 
  23. -rw-rw-r--  1 search search   932 5月  19 05:41 VERSION 

6,启动hue,执行命令:build/env/bin/supervisor 

  1. [search@h1 hue]$ build/env/bin/supervisor   
  2. [INFO] Not running as root, skipping privilege drop 
  3. 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': 'search', 'ssl_cipher_list': 'DEFAULT:!aNULL:!eNULL:!LOW:!EXPORT:!SSLv2', 'port': 8000, 'server_user': 'search'} 


然后我们就可以访问安装机ip+8000端口来查看了: 

工具箱界面: 

hive的界面: 

在配置hive(散仙这里是0.13的版本)的时候,需要注意以下几个方面: 
hive的metastrore的服务和hiveserver2服务都需要启动 
执行下面命令 
bin/hive --service metastore 
bin/hiveserver2 
除此之外,还需要关闭的hive的SAL认证,否则,使用hue访问会出现问题。 
注意下面三项的配置 

  1.  
  2.   hive.metastore.warehouse.dir 
  3.   /user/hive/warehouse 
  4.   location of default database for the warehouse 
  5.  
  6.  
  7.   hive.server2.thrift.port 
  8.   10000 
  9.   Port number of HiveServer2 Thrift interface. 
  10.   Can be overridden by setting $HIVE_SERVER2_THRIFT_PORT 
  11.  
  12.  
  13.   hive.server2.thrift.bind.host 
  14.   h1 
  15.   Bind host on which to run the HiveServer2 Thrift interface. 
  16.   Can be overridden by setting $HIVE_SERVER2_THRIFT_BIND_HOST 
  17.  
  18.  
  19.   hive.server2.authentication 
  20.   NOSASL 
  21.    
  22.     Client authentication types. 
  23.        NONE: no authentication check 
  24.        LDAP: LDAP/AD based authentication 
  25.        KERBEROS: Kerberos/GSSAPI authentication 
  26.        CUSTOM: Custom authentication provider 
  27.                (Use with property hive.server2.custom.authentication.class) 
  28.        PAM: Pluggable authentication module. 
  29.    
  30.  


除了上面的配置外,还需要把hive.server2.long.polling.timeout的参数值,默认是5000L给改成5000,否则使用beenline连接时候,会出错,这是hive的一个bug。 
pig的界面: 

solr的界面如下: 

最后需要注意一点,hue也需要在hadoop的core-site.xml里面配置相应的代理用户,示例如下: 

  1.  
  2.       hadoop.proxyuser.hue.hosts 
  3.      * 
  4.   
  5.     
  6.      hadoop.proxyuser.hue.groups 
  7.      * 
  8.      

ok至此,我们的hue已经能完美工作了,我们可以根据自己的需要,定制相应的app插件,非常灵活! 

更多Hadoop相关信息见Hadoop 专题页面 http://www./topicnews.aspx?tid=13

本文永久更新链接地址http://www./Linux/2016-07/133364.htm

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多