天天看點

hue安裝(maven、ant編譯)

Centos6.8安裝HUE

HUE 在編譯時有兩種方式:
1.通過maven、ant編譯 
2.通過python編譯(在centos6.5因為自身python為2.6.6版本和hue編譯需要2.7版本會有一點小沖 突,故采用1)兩種方式都是在hue目錄下 make apps,隻是第一種方式要先配置maven、ant的環境 而已
注意:不要使用root 使用者安裝
           

準備安裝環境

Centos6.8
Python 2.6.6(系統自帶)
apache-maven-3.x
jdk1.8及以上
apache-ant-1.8.1
hue-3.7.0-cdh5.3.6
           

安裝步驟

1.安裝Maven和Ant

自己下載下傳對應的壓縮包解壓并配置環境變量即可

将MAVEN_HOME/bin與ANT_HOME/bin添加到path下即可

别忘記source /etc/profile

最後檢查是否安裝成功
mvn -version
ant -v
隻要出現對應的版本即成功

           

2.安裝hue所需要的依賴包

如果更換了yum源,沒有緩存的話,需要更新一下緩存
yum clean all
yum makecache

安裝gcc
yum install gcc

安裝依賴


yum install asciidoc cyrus-sasl-devel cyrus-sasl-gssapi cyrus-sasl-plain gcc gcc-c++ krb5-devel libffi-devel libtidy libxml2-devel libxslt-devel make mysql mysql-devel openldap-devel python-devel sqlite-devel openssl-devel gmp-devel -y


如果報錯mysql的jar包沖突,是因為自己安裝的mysql版本與yum源安裝的mysql依賴版本不相容

解決方法:
由于Centos6下yum源安裝的mysql相關依賴預設是5.1.39版本,如果自己電腦上沒有安裝mysql,則直接使用以上指令安裝依賴,如果安裝了不同版本的mysql,則需要删掉上面指令中的mysql與mysql-devel,并且自己去mysql官網下載下傳自己安裝的mysql版本對應的mysql-devel的rpm包,并且自己安裝

<a href="https://dev.mysql.com/downloads/mysql/" target="_blank" rel="external nofollow" >mysql相關jar包下載下傳位址</a>


           

3.解壓下載下傳的hue的tar包并且編譯

tar -zxvf  hue-3.7.0-cdh5.3.6.tar -C /opt/app

cd /opt/app/hue-3.7.0-cdh5.3.6

make apps
           

4.權限處理

以上操作我都是在root下操作,但是說不讓使用root

是以我建立了hue使用者,并且修改hue檔案夾所有者和所屬組

useradd hue
passwd hue
chgrp hue 檔案名 -R
chown hue 檔案名 -R
           

5.修改配置檔案hue.ini

vim  /opt/app/hue-3.7.0-cdh5.3.6/desktop/conf/hue.ini

修改這八個屬性:

secret_key=jFE93j;2[290-eiw.KEiwN2s3['d;/.q[eIW^y#e=+Iei*@Mn<qW5o   官網給的key
http_host=hadoop111   本機的ip或主機名
http_port=8888        hue的端口号
time_zone=Asia/Shanghai      時區

# Webserver runs as this user 
server_user=root 
server_group=root
# This should be the Hue admin and proxy user 
default_user=root
# This should be the hadoop cluster admin 
default_hdfs_superuser=root

因為使用的是root使用者,是以修改了四個名字,将其都改為了root
如果使用hue使用者,那麼改為hue即可
 
           

6.測試

如果是HA則需要先啟動httpfs-site.xml
httpfs.sh start

如果不是HA則直接啟動hue

此時在hue的檔案目錄下啟動hue端口
cd /opt/app/hue-3.7.0-cdh5.3.6
開啟端口
build/env/bin/supervisor
此時通路8888端口(配置檔案裡自己配置的8888)

如果下面不配置hue的中繼資料存儲在mysql上
那麼第一次登陸時的賬戶密碼是以後hue的超級管理者,
需要自己牢記
如果下面配置了hue的中繼資料存儲在mysql上
則不需要記住,隻要能登入進去就行
           

7.hue與hdfs的內建

  • 修改httpfs-site.xml
  • 如果不是HA 則不需要配置httpfs-site.xml
#因為我用root使用者操作,是以我的代理使用者配置的root
<property>
 <name>httpfs.proxyuser.root.hosts</name>
 <value>*</value>
</property>
<property>
     <name>httpfs.proxyuser.root.groups</name>
 <value>*</value>
</property>
           
  • 修改hdfs-site.xml
<property> 
    <name>dfs.webhdfs.enabled</name>
    <value>true</value>
</property> 
<!-- 預設為true。如果為true,則啟用HDFS的權限檢查 否則不啟-->
<property>   
    <name>dfs.permissions.enabled</name> 
    <value>false</value> 
</property>

           
  • 修改core-site.xml
添加 
<property>
    <name>hadoop.proxyuser.hue.hosts</name>
    <value>*</value>
</property>
<property>
    <name>hadoop.proxyuser.hue.groups</name> 
    <value>*</value>
</property>
#設定代理使用者 
<!--因為我是用root操作的,是以我的代理使用者為root-->
<property> 
    <name>hadoop.proxyuser.root.hosts</name>
    <value>*</value>
</property> 
<property>  
    <name>hadoop.proxyuser.root.groups</name>
    <value>*</value>
</property>
           
  • 修改hue.ini檔案
找到[hadoop]标簽
修改
fs_defaultfs=hdfs://hadoop111:9000
##如果是HA 則預設的端口是14000 需要将50070改為14000
webhdfs_url=http://hadoop111:50070/webhdfs/v1
手動添加hadoop相對應的以下路徑
hadoop_conf_dir=/opt/app/hadoop-2.7.7/etc/hadoop/
hadoop_hin=/opt/app/hadoop-2.7.7/bin/
hadoop_hdfs_name=/opt/app/hadoop-2.7.7/

           

7.2 将hadoop的配置檔案分發到其他機器

scp core-site.xml hadoop02:/opt/app/hadoop-2.7.7/etc/hadoop
scp core-site.xml hadoop03:/opt/app/hadoop-2.7.7/etc/hadoop
scp hdfs-site.xml hadoop02:/opt/app/hadoop-2.7.7/etc/hadoop
scp hdfs-site.xml hadoop03:/opt/app/hadoop-2.7.7/etc/hadoop
scp httpfs-site.xml hadoop02:/opt/app/hadoop-2.7.7/etc/hadoop
scp httpfs-site.xml hadoop03:/opt/app/hadoop-2.7.7/etc/hadoop
           
  • 重新開機叢集

8.配置ResourceManager

  • 修改hue.ini檔案
[[yarn_clusters]]
    ...
    # [[[ha]]]
      # Resource Manager logical name (required for HA)
      #不是HA可以不配置
      logical_name=hadoop111

      # Un-comment to enable
      ## submit_to=True

      # URL of the ResourceManager API
      resourcemanager_api_url=http://hadoop111:8088
           

9.配置hive

  • 修改hue.ini檔案
[beeswax]
  # Host where HiveServer2 is running.
  # If Kerberos security is enabled, use fully-qualified domain name (FQDN).
  hive_server_host=hadoop111

  # Port where HiveServer2 Thrift server runs on.
  hive_server_port=10000

  # Hive configuration directory, where hive-site.xml is located
  hive_conf_dir=/opt/app/apache-hive-2.3.6/conf
           
  • 啟動hiveserver2
hive --service hiveserver2 &
           

10.配置hbase

  • hbase配置的是thriftserver2伺服器位址,不是master位址,而且需要用小括号包起來。thriftserver需要單獨啟動
  • 修改hue.ini檔案
[hbase]
  # Comma-separated list of HBase Thrift servers for clusters in the format of '(name|host:port)'.
  # Use full hostname with security.
  # If using Kerberos we assume GSSAPI SASL, not PLAIN.
  hbase_clusters=(hadoop111:9090)

  # HBase configuration directory, where hbase-site.xml is located.
  hbase_conf_dir=/opt/app/hbase/conf
           
  • 啟動thriftserver伺服器
hbase-daemon.sh start thrift
           

11.hue中繼資料更改存儲在mysql上

hue預設使用sqlite作為中繼資料庫,不推薦在生産環境中使用。會經常出現database is lock的問題。
更改為使用mysql作為中繼資料庫
           
  • 修改hue.ini檔案
...
    [[database]]
    # Database engine is typically one of:
    # postgresql_psycopg2, mysql, sqlite3 or oracle.
    #
    # Note that for sqlite3, 'name', below is a path to the filename. For other backends, it is the database name
    # Note for Oracle, options={"threaded":true} must be set in order to avoid crashes.
    # Note for Oracle, you can use the Oracle Service Name by setting "host=" and "port=" and then "name=<host>:<port>/<service_name>".
    # Note for MariaDB use the 'mysql' engine.
    engine=mysql
    host=192.168.80.111
    port=3306
    user=root
    password=root
    # Execute this script to produce the database password. This will be used when 'password' is not set.
    ## password_script=/path/script
    name=hue
    ## options={}
    # Database schema, to be used only when public schema is revoked in postgres
    ## schema=
           
  • 在mysql中create database hue
  • 初始化資料庫表
  • hue的初始化資料表指令由hue/bin/hue syncdb完成,建立期間,需要輸入使用者名和密碼
  • 這個使用者名和密碼即為登入hue的超級管理者密碼
#同步資料庫
$>~/hue-3.12.0/build/env/bin/hue syncdb
#導入資料,主要包括oozie、pig、desktop所需要的表
$>~/hue-3.12.0/build/env/bin/hue migrate
           
  • 檢視在mysql的hue資料庫中是否生成了所需要的表

12. 解決hue ui界面查詢中文亂碼問題

  • 在[[[mysql]]]節點下
  • options={ “init_command”:“SET NAMES ‘utf8’”}

繼續閱讀