gpfdist簡(jiǎn)介
gpfdist是Greenplum數(shù)據(jù)庫(kù)并行文件分發(fā)程序列赎⊥孪蓿可讀外部表和gpload使用它為所有Greenplum數(shù)據(jù)庫(kù)的segment并行地提供外部表文件秤茅。
可寫(xiě)外部表使用它并行地接受來(lái)自Greenplum數(shù)據(jù)庫(kù)的segment的輸出流璧亚,并將它們寫(xiě)到文件中砰识。使用gpfdist的好處是,在讀寫(xiě)外部表時(shí)块茁,可以保證最大的并行性齿坷,從而提供最佳的性能以及更容易管理外部表。更多官方原文描述請(qǐng)進(jìn)入gpfdist数焊。
gpfdist涉及軟件下載
要使用gpfdist服務(wù)永淌,需要安裝greenplum-clients和greenplum-loaders,進(jìn)入官網(wǎng)下載地址佩耳,選擇相應(yīng)版本下載client和loader的兩個(gè)安裝包遂蛀,本次使用到是4.3.7.0版本,相應(yīng)文件為:
greenplum-clients-4.3.7.0-build-2-RHEL5-x86_64.zip
greenplum-loaders-4.3.7.0-build-2-RHEL5-x86_64.zip
gpfdist涉及軟件安裝
將相應(yīng)安裝包上傳并解壓干厚,然后先安裝greenplum-clients答恶,再安裝greenplum-loaders。
基礎(chǔ)依賴安裝
[root@d6cba3b6f0c5 /]# yum install which java-1.8.0-openjdk -y
greenplum-clients安裝
[root@d6cba3b6f0c5 /]# ./greenplum-clients-4.3.7.0-build-2-RHEL5-x86_64.bin
執(zhí)行回車(chē)后首先會(huì)輸出使用許可協(xié)議萍诱,一直回車(chē)閱讀完后進(jìn)入正式安裝。
出現(xiàn)Do you accept the Pivotal Clients license agreement? [yes | no]污呼,在光標(biāo)處輸入yes裕坊,然后回車(chē),如下:
********************************************************************************
Do you accept the Pivotal Clients license agreement? [yes | no]
********************************************************************************
yes
輸入yes之后燕酷,要確認(rèn)client的默認(rèn)安裝目錄是否為/usr/local/greenplum-clients-4.3.7.0-build-2籍凝,如果默認(rèn)則按回車(chē)(enter)進(jìn)入下一步周瞎,如果想要指定目錄,可以輸入指定的安裝目錄饵蒂,此處選擇默認(rèn)安裝直接回車(chē)(enter)
********************************************************************************
Do you accept the Pivotal Clients license agreement? [yes | no]
********************************************************************************
yes
********************************************************************************
Provide the installation path for Greenplum Clients or press ENTER to
accept the default installation path: /usr/local/greenplum-clients-4.3.7.0-build-2
********************************************************************************
確認(rèn)將客戶端內(nèi)容安裝到/usr/local/greenplum-clients-4.3.7.0-build-2目錄下声诸,輸入yes即可進(jìn)入下一步:
********************************************************************************
Do you accept the Pivotal Clients license agreement? [yes | no]
********************************************************************************
yes
********************************************************************************
Provide the installation path for Greenplum Clients or press ENTER to
accept the default installation path: /usr/local/greenplum-clients-4.3.7.0-build-2
********************************************************************************
********************************************************************************
Install Greenplum Clients into </usr/local/greenplum-clients-4.3.7.0-build-2>? [yes | no]
********************************************************************************
yes
下面將會(huì)檢查主機(jī)是否存在默認(rèn)目錄,不存在將進(jìn)行默認(rèn)目錄創(chuàng)建退盯,如下所示:
********************************************************************************
/usr/local/greenplum-clients-4.3.7.0-build-2 does not exist.
Create /usr/local/greenplum-clients-4.3.7.0-build-2 ? [ yes | no ]
(Selecting no will exit the installer)
********************************************************************************
輸入yes后彼乌,開(kāi)始創(chuàng)建默認(rèn)目錄,并將文件導(dǎo)入到默認(rèn)目錄中渊迁,如果出現(xiàn)Installation complete字樣表示client安裝完成慰照,默認(rèn)目錄為/usr/local/greenplum-clients-4.3.7.0-build-2,如下:
********************************************************************************
/usr/local/greenplum-clients-4.3.7.0-build-2 does not exist.
Create /usr/local/greenplum-clients-4.3.7.0-build-2 ? [ yes | no ]
(Selecting no will exit the installer)
********************************************************************************
yes
Extracting product to /usr/local/greenplum-clients-4.3.7.0-build-2
********************************************************************************
Installation complete.
Greenplum Clients is installed in:
/usr/local/greenplum-clients-4.3.7.0-build-2
Pivotal Greenplum documentation is available
for download at http://docs.gopivotal.com/gpdb
********************************************************************************
[root@d6cba3b6f0c5 /]#
到對(duì)應(yīng)目錄查看就會(huì)看到新創(chuàng)建的目錄琉朽,如下所示:
[root@d6cba3b6f0c5 /]# ls /usr/local
bin etc games greenplum-clients-4.3.7.0-build-2 include lib lib64 libexec sbin share src
[root@d6cba3b6f0c5 /]#
greenplum-loaders安裝
greenplum-loaders的安裝與greenplum-clients的安裝步驟基本一致毒租,具體操作過(guò)程如下:
[root@d6cba3b6f0c5 /]# ./greenplum-loaders-4.3.7.0-build-2-RHEL5-x86_64.bin
********************************************************************************
You must read and accept the Pivotal Loaders license agreement
before installing
********************************************************************************
*** IMPORTANT INFORMATION - PLEASE READ CAREFULLY ***
PIVOTAL GREENPLUM DATABASE END USER LICENSE AGREEMENT
......//省略
Rev: Pivotal_GPDB_EULA_03182014.txt
********************************************************************************
Do you accept the Pivotal Loaders license agreement? [yes | no]
********************************************************************************
yes
********************************************************************************
Provide the installation path for Greenplum Loaders or press ENTER to
accept the default installation path: /usr/local/greenplum-loaders-4.3.7.0-build-2
********************************************************************************
********************************************************************************
Install Greenplum Loaders into </usr/local/greenplum-loaders-4.3.7.0-build-2>? [yes | no]
********************************************************************************
yes
********************************************************************************
/usr/local/greenplum-loaders-4.3.7.0-build-2 does not exist.
Create /usr/local/greenplum-loaders-4.3.7.0-build-2 ? [ yes | no ]
(Selecting no will exit the installer)
********************************************************************************
yes
Extracting product to /usr/local/greenplum-loaders-4.3.7.0-build-2
********************************************************************************
Installation complete.
Greenplum Loaders is installed in:
/usr/local/greenplum-loaders-4.3.7.0-build-2
Pivotal Greenplum documentation is available
for download at http://docs.gopivotal.com/gpdb
********************************************************************************
[root@d6cba3b6f0c5 /]#
gpfdist使用
首先為使用gpfdist的賬戶配置環(huán)境變量,例如test賬戶箱叁,具體操作如下:
[test@d6cba3b6f0c5 ~]$ echo 'source /usr/local/greenplum-loaders-4.3.7.0-build-2/greenplum_loaders_path.sh' >> ~/.bashrc
[test@d6cba3b6f0c5 ~]$ echo 'source /usr/local/greenplum-clients-4.3.7.0-build-2/greenplum_clients_path.sh' >> ~/.bashrc
[test@d6cba3b6f0c5 ~]$ source ~/.bashrc
[test@d6cba3b6f0c5 ~]$ echo 'source /usr/local/greenplum-loaders-4.3.7.0-build-2/greenplum_loaders_path.sh' >> ~/.bash_profile
[test@d6cba3b6f0c5 ~]$ echo 'source /usr/local/greenplum-clients-4.3.7.0-build-2/greenplum_clients_path.sh' >> ~/.bash_profile
[test@d6cba3b6f0c5 ~]$ source ~/.bash_profile
[test@d6cba3b6f0c5 ~]$
具體用法參照官網(wǎng)gpfdist的介紹墅垮,簡(jiǎn)單舉例如下:
[test@d6cba3b6f0c5 ~]$ gpfdist -d /data2
2020-11-16 16:56:29 48829 INFO Before opening listening sockets - following listening sockets are available:
2020-11-16 16:56:29 48829 INFO IPV6 socket: [::]:8080
2020-11-16 16:56:29 48829 INFO IPV4 socket: 0.0.0.0:8080
2020-11-16 16:56:29 48829 INFO Trying to open listening socket:
2020-11-16 16:56:29 48829 INFO IPV6 socket: [::]:8080
2020-11-16 16:56:29 48829 INFO Opening listening socket succeeded
2020-11-16 16:56:29 48829 INFO Trying to open listening socket:
2020-11-16 16:56:29 48829 INFO IPV4 socket: 0.0.0.0:8080
Serving HTTP on port 8080, directory /data2