CentOS6安裝各類大數據軟件 第九章:Hue大數據可視化工具安裝和配置

相關文章連接

CentOS6安裝各類大數據軟件 第一章:各個軟件版本介紹html

CentOS6安裝各類大數據軟件 第二章:Linux各個軟件啓動命令node

CentOS6安裝各類大數據軟件 第三章:Linux基礎軟件的安裝python

CentOS6安裝各類大數據軟件 第四章:Hadoop分佈式集羣配置mysql

CentOS6安裝各類大數據軟件 第五章:Kafka集羣的配置c++

CentOS6安裝各類大數據軟件 第六章:HBase分佈式集羣的配置web

CentOS6安裝各類大數據軟件 第七章:Flume安裝與配置sql

CentOS6安裝各類大數據軟件 第八章:Hive安裝和配置數據庫

CentOS6安裝各類大數據軟件 第九章:Hue大數據可視化工具安裝和配置express

CentOS6安裝各類大數據軟件 第十章:Spark集羣安裝和部署json

1. Hue概述和版本選擇

Hue是一個開源的Apache Hadoop UI系統,最先是由Cloudera Desktop演化而來,由Cloudera貢獻給開源社區,它是基於Python Web框架Django實現的.經過使用Hue咱們能夠再瀏覽器端的Web控制檯上與Hadoop集羣進行交互來分析處理數據,例如操做HDFS上的數據,運行MapReduce程序.等等。

官網:http://gethue.com/

CDH版本:http://archive-primary.cloudera.com/cdh5/cdh/5/

本次咱們採用的是CDH版本,版本號爲hue-3.7.0-cdh5.3.6.tar.gz

2. Hue安裝

2.1. 上傳壓縮包並進行解壓縮

tar -zxvf hue-3.7.0-cdh5.3.6.tar.gz -C /export/servers/

2.2. 增長hue用戶

由於hue的默認用戶不是使用root用戶,因此須要增長hue用戶,並設置好hue用戶的密碼(默認使用123456)。
#新增hue用戶
useradd hue
#給hue用戶設置密碼(默認爲123456)(輸入以下命令,點擊回車,再輸入密碼便可)
passwd hue

2.3. 修改hue安裝目錄的權限

chown -R hue:hue hue-3.7.0-cdh5.3.6/

2.4. 安裝hue須要的依賴

#Red-Hat(CentOS至關於Red-Hat)安裝依賴以下所示
yum install -y gcc gcc-c++ libxml2-devel libxslt-devel cyrus-sasl-devel cyrus-sasl-gssapi mysql-devel python-devel python-setuptools python-simplejson sqlite-devel ant libsasl2-dev libsasl2-modules-gssapi-mit libkrb5-dev libtidy-0.99-0 mvn openldap-dev libldap2-dev openldap-devel

依賴參考:http://archive-primary.cloudera.com/cdh5/cdh/5/hue-3.7.0-cdh5.3.6/manual.html

相關依賴列表以下表所示:

2.5. 編譯hue

切換成hue用戶,併到hue的頂層安裝目錄下 執行以下命令:

make apps

顯示以下結果爲編譯成功:

3. Hue基本配置和啓動

3.1. 配置hue.ini

在/export/servers/hue-3.7.0-cdh5.3.6/desktop/conf目錄下配置hue.ini
參照官網:http://archive-primary.cloudera.com/cdh5/cdh/5/hue-3.7.0-cdh5.3.6/manual.html#_configuring_hue的3.1章節
在hue.ini配置文件中配置祕鑰,訪問的ip地址和端口號,時區:
secret_key=jFE93j;2[290-eiw.KEiwN2s3['d;/.q[eIW^y#e=+Iei*@Mn<qW5o

# Webserver listens on this address and port
http_host=spark-node01.ouyang.com
http_port=8888

# Time zone name
time_zone=Asia/Shanghai

3.2. 修改權限和啓動服務

請檢查desktop目錄下的desktop.db文件和desktop/conf目錄下的hue.ini文件是否爲hue用戶組的hue用戶,若是不是,請修改。

#修改desktop目錄下的desktop.pb目錄的權限

chmod o+w /opt/modules/hue-3.7.0-cdh5.3.6/desktop/desktop.db

#在build目錄下啓動hue服務

build/env/bin/supervisor

3.3. 查看Hue的WEB界面

訪問地址:node01.ouyang.com:8888

第一次訪問,會讓建立一個用戶,這個用戶是超級用戶,擁有的權限比較多

登陸成功後便可進入hue主頁面:

4. Hue和HDFS集成

4.1. 修改HDFS的2個配置文件

4.1.1. 修改hdfs-site.xml配置文件

# 該配置文件路徑:/export/servers/hadoop-2.7.4/etc/Hadoop
# 在該文件中添加以下內容:
<!--開啓webhdfs-->
<property>
    <name>dfs.webhdfs.enabled</name>
    <value>true</value>
</property>

4.1.2. 修改core-site.xml配置文件

# 該配置文件路徑:/export/servers/hadoop-2.7.4/etc/Hadoop
# 在該文件中添加以下內容:
<!--開啓添加hue用戶和用戶組的信息-->
<property>
  <name>hadoop.proxyuser.hue.hosts</name>
  <value>*</value>
</property>
<property>
  <name>hadoop.proxyuser.hue.groups</name>
  <value>*</value>
</property>

4.2. 將修改的配置文件分發到其餘節點

scp core-site.xml node02.ouyang.com:$PWD
scp core-site.xml node03.ouyang.com:$PWD
scp hdfs-site.xml node02.ouyang.com:$PWD
scp hdfs-site.xml node03.ouyang.com:$PWD

4.3. 從新啓動HDFS到其餘節點

這裏執行hadoop的一鍵中止和啓動功能

4.4. 配置hue.ini

在[[hdfs_clusters]]標籤下進行hdfs的配置:

[[hdfs_clusters]]
    # HA support by using HttpFs

    [[[default]]]
      # Enter the filesystem uri
      fs_defaultfs=hdfs://node01.ouyang.com:9000

      # NameNode logical name.
      ## logical_name=

      # Use WebHdfs/HttpFs as the communication mechanism.
      # Domain should be the NameNode or HttpFs host.
      # Default port is 14000 for HttpFs.
      webhdfs_url=http://node01.ouyang.com:50070/webhdfs/v1

      # Change this if your HDFS cluster is Kerberos-secured
      ## security_enabled=false

      # Default umask for file and directory creation, specified in an octal value.
      ## umask=022

      # Directory of the Hadoop configuration
      hadoop_conf_dir= /export/servers/hadoop-2.7.4/etc/hadoop
      hadoop_hdfs_home= /export/servers/hadoop-2.7.4
      hadoop_bin= /export/servers/hadoop-2.7.4/bin

  # Configuration for YARN (MR2)

4.5. 從新啓動hue

./build/env/bin/supervisor

4.6. 在hue的web界面管理HDFS

在該界面裏能夠正常查看HDFS的文件夾和文件,還能夠對文件的內容進行查看,但根據上述配置還不能對文件進行編輯。

5. Hue和YARN集成

在[[yarn_clusters]]標籤下進行yarn的配置:

[[yarn_clusters]]

    [[[default]]]
      # Enter the host on which you are running the ResourceManager
      resourcemanager_host=node01.ouyang.com

      # The port where the ResourceManager IPC listens on
      resourcemanager_port=8032

      # Whether to submit jobs to this cluster
      submit_to=True

      # Resource Manager logical name (required for HA)
      ## logical_name=

      # Change this if your YARN cluster is Kerberos-secured
      ## security_enabled=false

      # URL of the ResourceManager API
      resourcemanager_api_url=http://node01.ouyang.com:8088

      # URL of the ProxyServer API
      proxy_api_url=http://node01.ouyang.com:8088

      # URL of the HistoryServer API
      history_server_api_url=http://node01.ouyang.com:19888

      # In secure mode (HTTPS), if SSL certificates from Resource Manager's
      # Rest Server have to be verified against certificate authority
      ## ssl_cert_ca_verify=False

修改配置文件後從新啓動yarn和hue服務。

當咱們將YARN服務啓動以後,從新刷新Hue的WEB UI界面,就能夠看到這條警告沒有了。

6. Hue和Hive集成

6.1. 配置hue.ini

在[beeswax]標籤下進行Hive的配置:

[beeswax]

  # Host where HiveServer2 is running.
  # If Kerberos security is enabled, use fully-qualified domain name (FQDN).
  hive_server_host=node01.ouyang.com

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

  # Hive configuration directory, where hive-site.xml is located
  hive_conf_dir=/export/servers/hive/conf
  hive_home_dir=/export/servers/hive

  # Timeout in seconds for thrift calls to Hive service
  ## server_conn_timeout=120

6.2. 修改tmp權限

由於hive服務的根文件保存在hdfs的/tmp目錄下,而該目錄只有root的執行權限,但hue是使用hue用戶啓動的,使用須要將/tmp目錄修改爲hue用戶能夠執行的權限。

hdfs dfs -chmod 777 /tmp

6.3. 啓動服務

從新啓動hue服務

啓動hive服務

由於有些hive表依賴HBase,使用也啓動HBase服務

7. Hue和MySQL集成

在hue.ini配置文件的[[databases]]標籤下修改MySQL的配置

# mysql, oracle, or postgresql configuration.
    [[[mysql]]]
      # Name to show in the UI.
      nice_name="My SQL DB"

      # For MySQL and PostgreSQL, name is the name of the database.
      # For Oracle, Name is instance of the Oracle server. For express edition
      # this is 'xe' by default.
      name=mysql

      # Database backend to use. This can be:
      # 1. mysql
      # 2. postgresql
      # 3. oracle
      engine=mysql

      # IP or hostname of the database to connect to.
      host=node01.ouyang.com

      # Port the database server is listening to. Defaults are:
      # 1. MySQL: 3306
      # 2. PostgreSQL: 5432
      # 3. Oracle Express Edition: 1521
      port=3306

      # Username to authenticate with when connecting to the database.
      user=root

      # Password matching the username to authenticate with when
      # connecting to the database.
      password=root

從新啓動hue,便可在hue的web界面進行MySQL數據庫的操做。

8. Hue和HBase集成

在hue.ini配置文件的[[hbase]]標籤下修改MySQL的配置

[hbase]
  # Comma-separated list of HBase Thrift servers for clusters in the format of '(name|host:port)'.
  # Use full hostname with security.
  hbase_clusters=(Cluster|node01.ouyang.com:9090)

  # HBase configuration directory, where hbase-site.xml is located.
  hbase_conf_dir=/export/servers/hbase/conf

配置完成後需重啓hue服務和啓動上述ip地址下的HBase的thriftserver服務。

bin/hbase-daemon.sh start thrift

相關文章
相關標籤/搜索