Greenplum 6 软件包目录畅游(下)

该篇文章为目录畅游的结束篇,系列文章请参阅社区文章《Greenplum 6 软件包目录畅游(上)》 和《Greenplum 6 软件包目录畅游(中)》 。

上篇文章带大家看完了include目录,本篇接着介绍剩余的内容。首先还是先来看一下软件包下面的所有目录情况。

[gpadmin@gp1 greenplum-db]$ ls -al
总用量 160
drwxr-xr-x  11 root root    187 12月 17 11:24 .
drwxr-xr-x. 14 root root    187 12月 17 11:24 ..
drwxr-xr-x   7 root root   4096 12月 17 11:24 bin
drwxr-xr-x   3 root root     22 12月 17 11:24 docs
drwxr-xr-x   2 root root     60 12月 17 11:24 etc
drwxr-xr-x   3 root root     20 12月 17 11:24 ext
-rwxr-xr-x   1 root root    783 12月 17 11:24 greenplum_path.sh
drwxr-xr-x   4 root root   4096 12月 17 11:24 include
drwxr-xr-x   6 root root   4096 12月 17 11:24 lib
-rw-r--r--   1 root root 135617 12月 13 02:57 open_source_license_pivotal_greenplum.txt
drwxr-xr-x   7 root root     93 12月 17 11:24 pxf
drwxr-xr-x   2 root root   4096 12月 17 11:24 sbin
drwxr-xr-x   5 root root     52 12月 17 11:24 share

目前剩余的目录还有lib目录、pxf目录、sbin目录和share目录。

lib目录

该目录下主要存的是动态链接库,程序运行过程中会动态将这些库文件加载。另外有一些别的内容,可以到目录下简单看一下。

-rwxr-xr-x  1 root root   662274 12月 13 02:57 libecpg.a
-rwxr-xr-x  1 root root    75844 12月 13 02:57 libecpg_compat.a
lrwxrwxrwx  1 root root       21 12月 17 11:24 libecpg_compat.so -> libecpg_compat.so.3.6
lrwxrwxrwx  1 root root       21 12月 17 11:24 libecpg_compat.so.3 -> libecpg_compat.so.3.6
-rwxr-xr-x  1 root root    64464 12月 13 02:57 libecpg_compat.so.3.6
lrwxrwxrwx  1 root root       14 12月 17 11:24 libecpg.so -> libecpg.so.6.6
lrwxrwxrwx  1 root root       14 12月 17 11:24 libecpg.so.6 -> libecpg.so.6.6
-rwxr-xr-x  1 root root   361496 12月 13 02:57 libecpg.so.6.6
lrwxrwxrwx  1 root root       16 12月 17 11:24 libgpdbcost.so -> libgpdbcost.so.3
lrwxrwxrwx  1 root root       21 12月 17 11:24 libgpdbcost.so.3 -> libgpdbcost.so.3.85.0
-rwxr-xr-x  1 root root  1122528 12月 13 02:57 libgpdbcost.so.3.85.0
lrwxrwxrwx  1 root root       13 12月 17 11:24 libgpopt.so -> libgpopt.so.3
lrwxrwxrwx  1 root root       18 12月 17 11:24 libgpopt.so.3 -> libgpopt.so.3.85.0
-rwxr-xr-x  1 root root 50101096 12月 13 02:57 libgpopt.so.3.85.0
lrwxrwxrwx  1 root root       12 12月 17 11:24 libgpos.so -> libgpos.so.3
lrwxrwxrwx  1 root root       17 12月 17 11:24 libgpos.so.3 -> libgpos.so.3.85.0
-rwxr-xr-x  1 root root  1988592 12月 13 02:57 libgpos.so.3.85.0
-rwxr-xr-x  1 root root   259280 12月 13 02:57 libgppc.a
lrwxrwxrwx  1 root root       14 12月 17 11:24 libgppc.so -> libgppc.so.1.2
lrwxrwxrwx  1 root root       14 12月 17 11:24 libgppc.so.1 -> libgppc.so.1.2
-rwxr-xr-x  1 root root   149680 12月 13 02:57 libgppc.so.1.2
...............
...............
...............

lib/gpperfmon目录

该目录下有gpperfmon(gpcc用的监控库)模式初始化文件gpperfmon.sql,该sql文件可以用来在gpperfmon中创建对应的内外表。具体内容自己可以打开看看,可以根据模式的内容构造一个自己的gpcc?。

lib/pkgconfig目录

源码编译用的一些文件,在编译和链接库文件时,通过这些.pc文件来指定文件的位置、版本号、编译选项等信息。

[gpadmin@gp1 pkgconfig]$ cat libzstd.pc
#   ZSTD - standard compression algorithm
#   Copyright (C) 2014-2016, Yann Collet, Facebook
#   BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)

prefix=/usr
libdir=/usr/lib64
includedir=/usr/include

Name: zstd
Description: fast lossless compression algorithm library
URL: http://www.zstd.net/
Version: 1.3.7
Libs: -L${libdir} -lzstd
Cflags: -I${includedir}

lib/postgresql目录

由于GP是基于PG内核开发的,所以一些postgresql的动态链接库放在该目录下。

[gpadmin@gp1 postgresql]$ ls -al
总用量 41768
drwxr-xr-x 3 root root     4096 12月 17 11:24 .
drwxr-xr-x 6 root root     4096 12月 17 11:24 ..
-rwxr-xr-x 1 root root    19920 12月 13 02:57 ascii_and_mic.so
-rwxr-xr-x 1 root root    97376 12月 13 02:57 auto_explain.so
-rwxr-xr-x 1 root root    54600 12月 13 02:57 citext.so
-rwxr-xr-x 1 root root    49528 12月 13 02:57 cyrillic_and_mic.so
-rwxr-xr-x 1 root root   245704 12月 13 02:57 dblink.so
-rwxr-xr-x 1 root root  1267072 12月 13 02:57 dict_snowball.so
-rwxr-xr-x 1 root root   404864 12月 13 02:57 diskquota.so
-rwxr-xr-x 1 root root    29880 12月 13 02:57 euc2004_sjis2004.so
-rwxr-xr-x 1 root root    21728 12月 13 02:57 euc_cn_and_mic.so
-rwxr-xr-x 1 root root    40496 12月 13 02:57 euc_jp_and_sjis.so
-rwxr-xr-x 1 root root    21720 12月 13 02:57 euc_kr_and_mic.so
-rwxr-xr-x 1 root root    40536 12月 13 02:57 euc_tw_and_big5.so
-rwxr-xr-x 1 root root   109176 12月 13 02:57 fixedwidth.so
-rwxr-xr-x 1 root root   185416 12月 13 02:57 fuzzystrmatch.so
-rwxr-xr-x 1 root root    82288 12月 13 02:57 gp_ao_co_diagnostics.so
-rwxr-xr-x 1 root root  7464944 12月 13 02:57 gpcloud.so
-rwxr-xr-x 1 root root    85288 12月 13 02:57 gp_distribution_policy.so
-rwxr-xr-x 1 root root    77768 12月 13 02:57 gpextprotocol.so
-rwxr-xr-x 1 root root   611544 12月 13 02:57 gpfmt_avro.so
-rwxr-xr-x 1 root root   113624 12月 13 02:57 gpfmt_binary.so
-rwxr-xr-x 1 root root   474792 12月 13 02:57 gpfmt_confluent_avro.so
-rwxr-xr-x 1 root root   110680 12月 13 02:57 gpfmt_delimiter.so
-rwxr-xr-x 1 root root   108192 12月 13 02:57 gpfmt_json.so
-rwxr-xr-x 1 root root   749016 12月 13 02:57 gpfmt_kafka.so
-rwxr-xr-x 1 root root 17311712 12月 13 02:57 gpfmt_protobuf.so
-rwxr-xr-x 1 root root    82088 12月 13 02:57 gpformatter.so
............
............
............

从上面的具体库文件命名也可以看出,有一部分gp的动态链接库也是放在这里面的,具体原因我也不知道?,等咨询官方开发大神再给大家更新。

lib/python目录

该目录下放的是python用到的库文件,例如:yaml、pygresql,这里面比较重要的一个就是pygresql,这是python语言访问pg系数据库的三方接口库,现在用的比较多的具有相同作用的库还有psycopg2,当然这里选用的是pygresql。

gpadmin@gp1 python]$ ls -al
总用量 220
drwxr-xr-x  7 root root   222 12月 17 11:24 .
drwxr-xr-x  6 root root  4096 12月 17 11:24 ..
drwxr-xr-x 10 root root  4096 12月 17 11:24 gppylib
-rwxr-xr-x  1 root root     0 12月 13 02:57 __init__.py
-rwxr-xr-x  1 root root   111 12月 13 02:57 __init__.pyc
drwxr-xr-x  2 root root    90 12月 17 11:24 lockfile
-rwxr-xr-x  1 root root 69992 12月 13 02:57 _posixsubprocess.so
drwxr-xr-x  3 root root  4096 12月 17 11:24 psutil
drwxr-xr-x  2 root root   117 12月 17 11:24 pygresql
-rwxr-xr-x  1 root root  3758 12月 13 02:57 subprocess32-ChangeLog
-rwxr-xr-x  1 root root 74362 12月 13 02:57 subprocess32.py
-rwxr-xr-x  1 root root 48477 12月 13 02:57 subprocess32.pyc
drwxr-xr-x  2 root root  4096 12月 17 11:24 yaml

sbin目录

该目录下存储的文件主要为bin目录下的一些集群管理工具的内部命令,这些python脚本不能直接调用,而只能通过bin目录下对应的脚本自行调用。该目录在使用过程中对用户是不可见的,程序会自动去调用,可以忽略。但是如果有源码修改需求,这部分下的脚本文件也不要忘掉哦。

[gpadmin@gp1 greenplum-db]$ ls -al sbin
总用量 128
drwxr-xr-x  2 root root  4096 12月 17 11:24 .
drwxr-xr-x 11 root root   187 12月 17 11:24 ..
-rwxr-xr-x  1 root root  2808 12月 13 02:57 gpcleansegmentdir.py
-rwxr-xr-x  1 root root  3303 12月 13 02:57 gpcleansegmentdir.pyc
-rwxr-xr-x  1 root root  6541 12月 13 02:57 gpconfig_helper.py
-rwxr-xr-x  1 root root  5648 12月 13 02:57 gpconfig_helper.pyc
-rwxr-xr-x  1 root root  9089 12月 13 02:57 gpgetstatususingtransition.py
-rwxr-xr-x  1 root root  8302 12月 13 02:57 gpgetstatususingtransition.pyc
-rwxr-xr-x  1 root root  1338 12月 13 02:57 gpmon_catqrynow.py
-rwxr-xr-x  1 root root  1186 12月 13 02:57 gpmon_catqrynow.pyc
-rwxr-xr-x  1 root root  1937 12月 13 02:57 gpoperation.py
-rwxr-xr-x  1 root root  1565 12月 13 02:57 gpoperation.pyc
-rwxr-xr-x  1 root root 14843 12月 13 02:57 gpsegstart.py
-rwxr-xr-x  1 root root 12309 12月 13 02:57 gpsegstart.pyc
-rwxr-xr-x  1 root root  8247 12月 13 02:57 gpsegstop.py
-rwxr-xr-x  1 root root  7641 12月 13 02:57 gpsegstop.pyc
-rwxr-xr-x  1 root root  7797 12月 13 02:57 packcore

share目录

这是最后一个目录,也是一个比较重要的目录,该目录中最重要的一个要数postgresql这个子目录。

[gpadmin@gp1 greenplum-db]$ ls -al share
drwxr-xr-x  3 root root   24 12月 17 11:24 doc
drwxr-xr-x  2 root root   41 12月 17 11:24 greenplum
drwxr-xr-x  8 root root 4096 12月 17 11:24 postgresql

share/doc目录

目前该目录下只存了orafce扩展的一些文档性信息。可以自行cat打开来看。

[gpadmin@gp1 greenplum-db]$ ls -al share/doc/postgresql/extension/
总用量 40
drwxr-xr-x 2 root root    75 12月 17 11:24 .
drwxr-xr-x 3 root root    23 12月 17 11:24 ..
-rwxr-xr-x 1 root root   987 12月 13 02:57 COPYRIGHT.orafce
-rwxr-xr-x 1 root root   874 12月 13 02:57 INSTALL.orafce
-rwxr-xr-x 1 root root 31364 12月 13 02:57 README.asciidoc

share/postgresql/extension目录

该目录下放了很多创建扩展用到的control文件和sql文件,比较著名的有:citext、dblink、hstore、orafce、存储过程语言扩展、pxf等等,可以说我们在GP数据库中执行创建扩展语句CREATE Extention xxxx时,它会从这个目录下寻找对应的control文件并执行对应的SQL,在数据库中创建对应的函数、类型等内容。

[gpadmin@gp1 greenplum-db]$ ls -al share/postgresql/extension/
总用量 432
drwxr-xr-x 2 root root  4096 12月 17 11:24 .
drwxr-xr-x 8 root root  4096 12月 17 11:24 ..
-rwxr-xr-x 1 root root  1028 12月 13 02:57 citext--1.0--1.1.sql
-rwxr-xr-x 1 root root 12337 12月 13 02:57 citext--1.0.sql
-rwxr-xr-x 1 root root  1001 12月 13 02:57 citext--1.1--1.0.sql
-rwxr-xr-x 1 root root 12364 12月 13 02:57 citext--1.1.sql
-rwxr-xr-x 1 root root   158 12月 13 02:57 citext.control
-rwxr-xr-x 1 root root  9839 12月 13 02:57 citext--unpackaged--1.0.sql
-rwxr-xr-x 1 root root   419 12月 13 02:57 dblink--1.0--1.1.sql
-rwxr-xr-x 1 root root  5936 12月 13 02:57 dblink--1.1.sql
-rwxr-xr-x 1 root root   170 12月 13 02:57 dblink.control
-rwxr-xr-x 1 root root  2863 12月 13 02:57 dblink--unpackaged--1.0.sql
-rw-r--r-- 1 root root  2674 12月 13 02:57 diskquota--1.0.sql
-rw-r--r-- 1 root root   139 12月 13 02:57 diskquota.control
-rwxr-xr-x 1 root root  1436 12月 13 02:57 fuzzystrmatch--1.0.sql
-rwxr-xr-x 1 root root   175 12月 13 02:57 fuzzystrmatch.control
-rwxr-xr-x 1 root root  1108 12月 13 02:57 fuzzystrmatch--unpackaged--1.0
................
................
................

pxf目录

在GPDB 4.x的时代,我们连接Hadoop系是通过gphdfs来实现的,但是这种方式的可用性和可扩展性并不强。所以从GPDB 5.x开始,GPDB从HAWQ(HAWQ是Pivotal开源的另一款软件,一款底层存储基于HDFS,前端引擎基于GPDB,支持大规模并行处理的软件)中吸收了pxf框架。该框架通过扩展的形式在GPDB中创建,它能够使GPDB以并行的方式从HDFS、Hbase、Hive或其他存储中查询数据,pxf在目标侧通过Java语言与Hadoop系进行交互,而在GPDB侧则通过C做底层交互,打通GPDB与Hadoop数据的任督二脉。使用方面只需要在创建外部表时指定协议为pxf即可。

[gpadmin@gp1 pxf]$ ls -al
总用量 4
drwxr-xr-x  7 root root  93 12月 17 11:24 .
drwxr-xr-x 11 root root 187 12月 17 11:24 ..
drwxr-xr-x  9 root root 220 12月 17 11:24 apache-tomcat
drwxr-xr-x  2 root root  32 12月 17 11:24 bin
drwxr-xr-x  2 root root  64 12月 17 11:24 conf
drwxr-xr-x  3 root root 252 12月 17 11:24 lib
drwxr-xr-x  5 root root  43 12月 17 11:24 templates
-rw-r--r--  1 root root   7 12月 13 02:57 version

这里不展开给大家详细介绍pxf的每个字目录的作用了,后面在pxf的详细使用介绍文章中再具体说明。

Greenplum 6 软件包目录畅游部分到此结束~欢迎给位朋友拍砖~

关注微信公众号

VMware 中国研发中心