一、安装包准备
二、安装过程
三、启动gpfdist服务
四、常见问题
业务中使用了该工具对数据进行持久化,windows环境一直没有安装这个工具,对调试代码很不方便,因为只能调试到write file那里,之后的从外部表经过数据清洗加载到目标表的过程就是个黑盒子。...
一、安装包准备
环境 : GP 4.3
官方地址:https://network.pivotal.io/products/pivotal-gpdb
下载速度比较慢,可在这里下载。
二、安装过程
2.1 直接按照正常软件安装一样的方法,安装完成后如下图。
![1baf068998957230b109b7f7f3caad62.png](https://img-blog.csdnimg.cn/img_convert/1baf068998957230b109b7f7f3caad62.png)
进入bin目录,一会启动服务的时候就是用gpfdist可执行文件来启动gpfdist。
![5058c714779d378875852b70ff05b5c0.png](https://img-blog.csdnimg.cn/img_convert/5058c714779d378875852b70ff05b5c0.png)
需要依赖python 环境,版本要求如图。
gploader应该就是python写的脚本。
![d4623f1c0e6a3aadf3e6df7d96cf0ac9.png](https://img-blog.csdnimg.cn/img_convert/d4623f1c0e6a3aadf3e6df7d96cf0ac9.png)
三、启动gpfdist服务
这里主要有两个参数 -p 指定启动端口,默认是8080,
-d 指要通过gpfdist程序写入数据库的文件,格式不限于csv,txt...etc,其他的参数如下,有兴趣自行学习。
gpfdist -- file distribution web server usage: gpfdist [--ssl ] [--sslclean ] [-d ] [-p ] [-l ] [-t ] [-v | -V | -s] [-m ] [-w ][-c file] gpfdist [-? | --help] | --version -?, --help : print this screen -v : verbose mode -V : more verbose -s : simplified minimum log -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 -S : open the file for synchronous I/O with the O_SYNC flag --ssl dir : start HTTPS server. Use the certificates from the specified directory --sslclean time : define the time to wait until cleanup the SSL resources, default is 0 -c file : configuration file for transformations --version : print version information -w timeout : timeout in seconds before close target file
针对window平台,按照如下方式即可启动
1、C:Program Files (x86)Greenplumgreenplum-loaders-4.3.27.0bin>cd Program Files (x86)Greenplumgreenplum-loaders-4.3.27.0bin 2、C:Program Files (x86)Greenplumgreenplum-loaders-4.3.27.0bin>gpfdist.exe -p 8080 -d E:aplogdata
启动成功后会显示如下:
![91f9b5faa93015836c85965d412a78fe.png](https://img-blog.csdnimg.cn/img_convert/91f9b5faa93015836c85965d412a78fe.png)
四、常见问题
1、加载数据时这种报错是gpfdist启动有问题。
qmstst=# select * from extlocaltest;ERROR: connection with gpfdist failed for gpfdist://10.**.**.**:8080/localtest.txt. effective url: http://10.**.**.**:8080/localtest.txt. error code = 111 (Connection refused) (seg2 slice1 P1TST01:40002 pid=21667)qmstst=#
2、当加载数据时,可以注意观察gpfdist log的变化,根据具体报错具体分析问题。gpfdist的log还是比较详细的,如果想进一步了解其原理,建议点击这里。