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/">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’”}

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