基于【CentOS-7+ Ambari 2.7.0 + HDP 3.0】HAWQ数据仓库 使用之 gpfdist协议
生活随笔
收集整理的這篇文章主要介紹了
基于【CentOS-7+ Ambari 2.7.0 + HDP 3.0】HAWQ数据仓库 使用之 gpfdist协议
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
一、HAWQ基本安裝自帶gpfdist協議
gpfdist是HAWQ支持的外部表訪問協議之一,這是hawq自帶的一個簡單的集成http服務命令。
在我的前述安裝hawq之后,gpfdist命令位于hawq的bin目錄之中。/opt/gpadmin/apache-hawq/bin/gpfdist
gpfdist使用說明很簡單,且看:
[root@ep-bd01 ~]# /opt/gpadmin/apache-hawq/bin/gpfdist --help gpfdist -- file distribution web serverusage: gpfdist [--ssl <certificates_directory>] [-d <directory>] [-p <http(s)_port>] [-l <log_file>] [-t <timeout>] [-v | -V] [-m <maxlen>][-c file]gpfdist [-? | --help] | --version-?, --help : print this screen-v : verbose mode-V : more verbose-p port : port to serve HTTP(S), default is 8080-d dir : serve files under the specified directory, default is '.'-l logfn : log filename-t tm : timeout in seconds -m maxlen : max data row length expected, in bytes. default is 32768--ssl dir : start HTTPS server. Use the certificates from the specified directory-c file : configuration file for transformations--version : print version information這里我只關心-d和-p兩個命令行參數
二、gpfdist服務簡單使用
1,啟動gpfdist服務
gpfdist不像pxf協議那么麻煩,由于他只是服務于本機目錄,所以只要在數據目錄所在的主機上啟動gpfdist,hawq即可訪問了。
[root@ep-bd01 ~]# /opt/gpadmin/apache-hawq/bin/gpfdist -p8809 -d/var/data/ext Serving HTTP on port 8809, directory /var/data/ext2,準備數據文件
1)建立本地路徑/var/data/ext/yxbw
2)路徑放置從hdfs文件系統中復制過來的用sqoop從其他數據庫系統的數據表導入的數據文件,并且導入時啟用了--compress參數,所以數據文件是gz壓縮格式,這個gpfdist協議可以直接訪問。
[root@ep-bd01 pxf]# hdfs dfs -copyToLocal /var/data/ext/table1/* /var/data/ext/table1/. [root@ep-bd01 pxf]# ll /var/data/ext/table1/ 總用量 152 -rw-r--r--. 1 root root 69503 9月 10 09:45 part-m-00000.gz -rw-r--r--. 1 root root 41334 9月 10 09:45 part-m-00001.gz -rw-r--r--. 1 root root 24035 9月 10 09:45 part-m-00002.gz -rw-r--r--. 1 root root 14345 9月 10 09:45 part-m-00003.gz -rw-r--r--. 1 root root 0 9月 10 09:45 _SUCCESS?
3,建立hawq外部表
注意,gpfdist路徑中的table1路徑是相對于gpfdist服務啟動時通過參數"-d"指定的數據路徑的。
create external table ext.table1 (occur_time date, ......) location ('gpfdist://ep-bd01:8081/table1') format 'text'(delimiter ',' null '');4,訪問外部表
epbd=> select count(*) from ext.table1;count -------6288 (1 row)Time: 258.015 ms?
總結
以上是生活随笔為你收集整理的基于【CentOS-7+ Ambari 2.7.0 + HDP 3.0】HAWQ数据仓库 使用之 gpfdist协议的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Ant Design Pro开发后台管理
- 下一篇: nodejs源码—初始化