「揭祕GP」Greenplum 6 軟件包目錄暢遊

今天咱們來一起看看 Greenplum 安裝目錄分別都有什麼內容,具體作用是什麼。請大家注意,本文章中介紹的僅僅是軟件安裝目錄的內容,並沒有涉及到數據存儲目錄的內容,二者不能混爲一談

軟件包安裝位置

Greenplum 6 在安裝完成後,與大部分其他應用軟件的位置一致,默認的安裝位置爲 /usr/local 下。

[gpadmin@gp1 local]$ ls -al
總用量 4
drwxr-xr-x. 14 root root  187 12月 17 11:24 .
drwxr-xr-x. 13 root root  155 9月   1 21:55 ..
drwxr-xr-x.  2 root root  160 12月 27 17:58 bin
drwxr-xr-x.  2 root root    6 4月  11 2018 etc
drwxr-xr-x.  2 root root    6 4月  11 2018 games
drwxr-xr-x  10 root root  272 9月  26 02:53 go
lrwxrwxrwx   1 root root   29 12月 17 11:24 greenplum-db -> /usr/local/greenplum-db-6.2.1
drwxr-xr-x  11 root root  187 12月 17 11:24 greenplum-db-6.2.1
drwxr-xr-x.  3 root root   20 12月 27 17:58 include
drwxr-xr-x.  3 root root 4096 12月 27 17:58 lib
drwxr-xr-x.  3 root root   19 9月   8 04:18 lib64
drwxr-xr-x.  2 root root    6 4月  11 2018 libexec
drwxr-xr-x.  2 root root    6 4月  11 2018 sbin
drwxr-xr-x.  9 root root  107 12月 27 17:58 share
drwxr-xr-x.  2 root root    6 4月  11 2018 src
[gpadmin@gp1 local]$ pwd
/usr/local

從上面的 shell 查詢結果可以看到,有兩個叫 Greenplum 的東西。[ greenplum-db-6.2.1 ] 是真正的代碼目錄,軟件安裝完後,所有與 Greenplum 相關的內容均存儲在這個目錄下,[ greenplum-db ] 這個則是一個軟連接,指向上面目錄。這裏採用軟連接的方式對於系統管理和升級都非常方便,同一大版本,基本可以通過更新軟連接指向的方式升級;而採用統一軟連接的名稱也能避免一些維護程序的修改工作。

軟件目錄暢遊

首先我們來看一下 Greenplum 軟件安裝目錄下的內容都有哪些。

[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

bin目錄

故名思義,這個目錄下的文件基本都是 Greenplum 的可執行命令,與其他 Linux 軟件的套路一樣,如果想要使用 bin 下面的命令,bin 目錄必須被添加到操作系統 PATH 變量,所不同的是,我們不需要手工處理該操作,當你在 source greenplum_path.sh 的時候,這些工作他已經幫你完成了。

gpadmin@gp1 greenplum-db]$ ls -al bin
總用量 122048
drwxr-xr-x  7 root root     4096 12月 17 11:24 .
drwxr-xr-x 11 root root      187 12月 17 11:24 ..
-rwxr-xr-x  1 root root    65125 12月 13 02:57 analyzedb
-rwxr-xr-x  1 root root   251160 12月 13 02:57 clusterdb
-rwxr-xr-x  1 root root   246904 12月 13 02:57 createdb
-rwxr-xr-x  1 root root   383616 12月 13 02:57 createlang
-rwxr-xr-x  1 root root   249536 12月 13 02:57 createuser
-rwxr-xr-x  1 root root   230096 12月 13 02:57 dropdb
-rwxr-xr-x  1 root root   383512 12月 13 02:57 droplang
-rwxr-xr-x  1 root root   229880 12月 13 02:57 dropuser
-rwxr-xr-x  1 root root  2188616 12月 13 02:57 ecpg
-rwxr-xr-x  1 root root    16204 12月 13 02:57 gpactivatestandby
-rwxr-xr-x  1 root root      493 12月 13 02:57 gpaddmirrors
-rwxr-xr-x  1 root root   166749 12月 13 02:57 gpcheckcat
drwxr-xr-x  2 root root     4096 12月 17 11:24 gpcheckcat_modules
-rwxr-xr-x  1 root root  2514288 12月 13 02:57 gpcheckcloud
-rwxr-xr-x  1 root root    27480 12月 13 02:57 gpcheckperf
-rwxr-xr-x  1 root root     6052 12月 13 02:57 gpcheckresgroupimpl
-rwxr-xr-x  1 root root    22604 12月 13 02:57 gpconfig
drwxr-xr-x  2 root root     4096 12月 17 11:24 gpconfig_modules
-rwxr-xr-x  1 root root    14497 12月 13 02:57 gpdeletesystem
-rwxr-xr-x  1 root root   109833 12月 13 02:57 gpexpand
-rwxr-xr-x  1 root root   435688 12月 13 02:57 gpfdist
-rwxr-xr-x  1 root root    32095 12月 13 02:57 gpinitstandby
-rwxr-xr-x  1 root root    81788 12月 13 02:57 gpinitsystem
-rwxr-xr-x  1 root root  6475584 12月 13 02:57 gpkafka
-rwxr-xr-x  1 root root      320 12月 13 02:57 gpload
-rwxr-xr-x  1 root root      202 12月 13 02:57 gpload.bat
-rwxr-xr-x  1 root root   107558 12月 13 02:57 gpload.py
-rwxr-xr-x  1 root root    82833 12月 13 02:57 gpload.pyc
-rwxr-xr-x  1 root root    20933 12月 13 02:57 gplogfilter
-rwxr-xr-x  1 root root   456216 12月 13 02:57 gpmapreduce
-rwxr-xr-x  1 root root   373232 12月 13 02:57 gpmmon
-rwxr-xr-x  1 root root    20400 12月 13 02:57 gpmovemirrors
-rwxr-xr-x  1 root root     1224 12月 13 02:57 gpperfmoncat.sh
-rwxr-xr-x  1 root root     7675 12月 13 02:57 gpperfmon_install
-rwxr-xr-x  1 root root      339 12月 13 02:57 gppkg
-rwxr-xr-x  1 root root      547 12月 13 02:57 gprecoverseg
-rwxr-xr-x  1 root root     1149 12月 13 02:57 gpreload
-rwxr-xr-x  1 root root     4144 12月 13 02:57 gpscp
-rwxr-xr-x  1 root root     9503 12月 13 02:57 gpsd
-rwxr-xr-x  1 root root   233960 12月 13 02:57 gpsmon
-rwxr-xr-x  1 root root 19323328 12月 13 02:57 gpss
-rwxr-xr-x  1 root root 16547104 12月 13 02:57 gpsscli
-rwxr-xr-x  1 root root     9173 12月 13 02:57 gpssh
-rwxr-xr-x  1 root root    32583 12月 13 02:57 gpssh-exkeys
drwxr-xr-x  2 root root       98 12月 17 11:24 gpssh_modules
-rwxr-xr-x  1 root root    35203 12月 13 02:57 gpstart
-rwxr-xr-x  1 root root      421 12月 13 02:57 gpstate
-rwxr-xr-x  1 root root    46654 12月 13 02:57 gpstop
-rwxr-xr-x  1 root root     2731 12月 13 02:57 gpsys1
-rwxr-xr-x  1 root root   490216 12月 13 02:57 initdb
drwxr-xr-x  3 root root     4096 12月 17 11:24 lib
-rwxr-xr-x  1 root root    15198 12月 13 02:57 minirepro
-rwxr-xr-x  1 root root   295288 12月 13 02:57 pg_basebackup
-rwxr-xr-x  1 root root  1658352 12月 13 02:57 pgbouncer
-rwxr-xr-x  1 root root   102544 12月 13 02:57 pg_config
-rwxr-xr-x  1 root root   122920 12月 13 02:57 pg_controldata
-rwxr-xr-x  1 root root   156128 12月 13 02:57 pg_ctl
-rwxr-xr-x  1 root root  1564928 12月 13 02:57 pg_dump
-rwxr-xr-x  1 root root   314808 12月 13 02:57 pg_dumpall
-rwxr-xr-x  1 root root   232336 12月 13 02:57 pg_isready
-rwxr-xr-x  1 root root   182928 12月 13 02:57 pg_receivexlog
-rwxr-xr-x  1 root root   193880 12月 13 02:57 pg_recvlogical
-rwxr-xr-x  1 root root   165248 12月 13 02:57 pg_resetxlog
-rwxr-xr-x  1 root root   723712 12月 13 02:57 pg_restore
-rwxr-xr-x  1 root root   454736 12月 13 02:57 pg_rewind
-rwxr-xr-x  1 root root   753768 12月 13 02:57 pg_upgrade
-rwxr-xr-x  1 root root   513592 12月 13 02:57 pg_xlogdump
-rwxr-xr-x  1 root root 63414200 12月 13 02:57 postgres
lrwxrwxrwx  1 root root        8 12月 17 11:24 postmaster -> postgres
-rwxr-xr-x  1 root root  1491912 12月 13 02:57 psql
-rwxr-xr-x  1 root root   250648 12月 13 02:57 reindexdb
drwxr-xr-x  2 root root       20 12月 17 11:24 stream
-rwxr-xr-x  1 root root   259960 12月 13 02:57 vacuumdb
[gpadmin@gp1 greenplum-db]$

以上列表具體軟件的用途不詳細展開了,可以移步官方文檔或者部分參考 Greenplum 中文社區的開源GPDB 6中文文檔(不包含企業級組件的使用,如gpkafka、gpss等,企業級組件建議購買官方服務或參考官方英文文檔),這裏簡單提一下,從GPDB 5.x開始,已經陸續增加和刪除了幾個常用的組件,分別如下:

  • 新增 gpkafka,用於對接 kafka 數據;
  • 新增 gpbackup 工具用於數據備份,屬於單獨組件,不在默認安裝包中;
  • 新增 gpcopy 工具,用於集羣數據複製和遷移;
  • 刪除 gpcheck 工具,該工具原來用於驗證操作系統參數配置;
  • 刪除 gpfilespace 工具,該工具原來用於創建文件空間;
  • 刪除 gp_dump 和 gpcrondump,該工具原來用於備份GP集羣,目前已經被 gpbackup 替代;

首先還是來看一下軟件包下面的所有目錄情況。

[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

docs 目錄

該目錄下主要存儲的是 bin 目錄下管理命令的幫助信息,普通使用用戶毋需關心該目錄下的內容。大體瀏覽一下:

[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

[gpadmin@gp1 greenplum-db]$ ls -al docs
總用量 4
drwxr-xr-x  3 root root   22 12月 17 11:24 .
drwxr-xr-x 11 root root  187 12月 17 11:24 ..
drwxr-xr-x  3 root root 4096 12月 17 11:24 cli_help

[gpadmin@gp1 greenplum-db]$ ls -al docs/cli_help/
總用量 212
drwxr-xr-x 3 root root  4096 12月 17 11:24 .
drwxr-xr-x 3 root root    22 12月 17 11:24 ..
-rwxr-xr-x 1 root root  4752 12月 13 02:57 gpactivatestandby_help
-rwxr-xr-x 1 root root  7678 12月 13 02:57 gpaddmirrors_help
-rwxr-xr-x 1 root root  9221 12月 13 02:57 gpcheckperf_help
-rwxr-xr-x 1 root root  6970 12月 13 02:57 gpconfig_help
drwxr-xr-x 2 root root  4096 12月 17 11:24 .....
..........
..........
..........

docs/gpconfigs 目錄

docs 目錄下的 gpconfigs 子目錄還蠻重要的,認真看過官方文檔的人肯定會有印象,裏面不止一次的涉及到過從這個目錄下複製參考示例,作爲數據庫初始化配置等操作的模版文件。

[gpadmin@gp1 docs]$ ls -al cli_help/gpconfigs/
總用量 60
drwxr-xr-x 2 root root 4096 12月 17 11:24 .
drwxr-xr-x 3 root root 4096 12月 17 11:24 ..
-rwxr-xr-x 1 root root 2426 12月 13 02:57 gpinitsystem_config
-rwxr-xr-x 1 root root 4511 12月 13 02:57 gpinitsystem_singlenode
-rwxr-xr-x 1 root root 2325 12月 13 02:57 gpinitsystem_test
-rwxr-xr-x 1 root root  359 12月 13 02:57 hostfile_exkeys
-rwxr-xr-x 1 root root  119 12月 13 02:57 hostfile_gpchecknet_ic1
-rwxr-xr-x 1 root root  119 12月 13 02:57 hostfile_gpchecknet_ic2
-rwxr-xr-x 1 root root   87 12月 13 02:57 hostfile_gpcheckperf
-rwxr-xr-x 1 root root  255 12月 13 02:57 hostfile_gpexpand
-rwxr-xr-x 1 root root  237 12月 13 02:57 hostfile_gpinitsystem
-rwxr-xr-x 1 root root   96 12月 13 02:57 hostfile_gpssh_allhosts
-rwxr-xr-x 1 root root   87 12月 13 02:57 hostfile_gpssh_segonly
-rwxr-xr-x 1 root root   44 12月 13 02:57 hostlist_singlenode

ext 目錄

該目錄用來存放 python 基礎環境及一些擴展包。Greenplum 爲了與操作系統自身的 python 環境區別開,特意在安裝包中集成了 python 2.7(目前還是採用的python 2.7作爲執行器),這樣就可以直接使用自帶的 python 來運行一些管理維護工具(基於python寫的工具,例如:gpload、gpstart等)。

[gpadmin@gp1 greenplum-db]$ ls -al ext/python/
總用量 0
drwxr-xr-x 6 root root  56 12月 17 11:24 .
drwxr-xr-x 3 root root  20 12月 17 11:24 ..
drwxr-xr-x 2 root root 189 12月 17 11:24 bin
drwxr-xr-x 3 root root  23 12月 17 11:24 include
drwxr-xr-x 4 root root  90 12月 17 11:24 lib
drwxr-xr-x 3 root root  17 12月 17 11:24 share

這裏需要特別注意,不要採用 root 用戶來運行 Greenplum,也不要將 source greenplum_path.sh 放到整個Linux系統的 /etc/profile 中去,如果你已經這麼做了,請儘快修改,因爲這會導致系統其他用戶(尤其是root),也採用 Greenplum 自帶的 python,最簡單的後果就是可能會影響到 root 用戶的 yum 不能正常使用。

上面提到了“不要將 source greenplum_path.sh 放到整個 Linux 系統的 /etc/profile 中去”,因爲這個配置文件中有一步是重置 pythonhome,你可以自己打開去確認,這裏截取部分代碼,如下:

#setup PYTHONHOME
if [ -x $GPHOME/ext/python/bin/python ]; then
    PYTHONHOME="$GPHOME/ext/python"
    export PYTHONHOME
fi

greenplum_path.sh 文件

該文件主要用來設置環境變量,代碼如下,設置的環境變量分別爲:

  • GPHOME – Greenplum 安裝的絕對路徑
  • GPHOME – 更新 GPHOME 爲軟連接路徑
  • PYTHONHOME – 設置 Greenplum 操作系統用戶使用的 Python 執行器爲 Greenplum 自帶(上面提到了)
  • OPENSSL_CONF – 設置 openssl 配置文件路徑
  • LD_LIBRARY_PATH – 更新該變量,添加 Python 庫
  • PATH – 更新該變量,增加 Greenplum 和 Python 命令
GPHOME=/usr/local/greenplum-db-6.2.1

# Replace with symlink path if it is present and correct
if [ -h ${GPHOME}/../greenplum-db ]; then
    GPHOME_BY_SYMLINK=`(cd ${GPHOME}/../greenplum-db/ && pwd -P)`
    if [ x"${GPHOME_BY_SYMLINK}" = x"${GPHOME}" ]; then
        GPHOME=`(cd ${GPHOME}/../greenplum-db/ && pwd -L)`/.
    fi
    unset GPHOME_BY_SYMLINK
fi
#setup PYTHONHOME
if [ -x $GPHOME/ext/python/bin/python ]; then
    PYTHONHOME="$GPHOME/ext/python"
    export PYTHONHOME
fi
PYTHONPATH=$GPHOME/lib/python
PATH=$GPHOME/bin:$PYTHONHOME/bin:$PATH
LD_LIBRARY_PATH=$GPHOME/lib:$PYTHONHOME/lib:${LD_LIBRARY_PATH-}
export LD_LIBRARY_PATH
if [ -e $GPHOME/etc/openssl.cnf ]; then
OPENSSL_CONF=$GPHOME/etc/openssl.cnf
export OPENSSL_CONF
fi
export GPHOME
export PATH
export PYTHONPATH

include 目錄

頭文件,這個目錄下的頭文件基本都是一些公共函數文件,例如 libpq、zstd 都有是現成的。不多解釋,非開發人員也不會用到,開發人員自然懂。

[gpadmin@gp1 greenplum-db]$ ls -al include
總用量 328
drwxr-xr-x  4 root root  4096 12月 17 11:24 .
drwxr-xr-x 11 root root   187 12月 17 11:24 ..
-rwxr-xr-x  1 root root   714 12月 13 02:57 ecpg_config.h
-rwxr-xr-x  1 root root  2540 12月 13 02:57 ecpgerrno.h
-rwxr-xr-x  1 root root  2758 12月 13 02:57 ecpg_informix.h
-rwxr-xr-x  1 root root  2607 12月 13 02:57 ecpglib.h
-rwxr-xr-x  1 root root  2621 12月 13 02:57 ecpgtype.h
-rwxr-xr-x  1 root root   778 12月 13 02:57 gppc_config.h
-rwxr-xr-x  1 root root 65607 12月 13 02:57 gppc.h
drwxr-xr-x  2 root root    24 12月 17 11:24 libpq
-rwxr-xr-x  1 root root  2208 12月 13 02:57 libpq-events.h
-rwxr-xr-x  1 root root 22057 12月 13 02:57 libpq-fe.h
-rwxr-xr-x  1 root root   323 12月 13 02:57 pg_config_ext.h
-rwxr-xr-x  1 root root 33050 12月 13 02:57 pg_config.h
-rwxr-xr-x  1 root root 10616 12月 13 02:57 pg_config_manual.h
-rwxr-xr-x  1 root root  1052 12月 13 02:57 pg_config_os.h
-rwxr-xr-x  1 root root   787 12月 13 02:57 pgtypes_date.h
-rwxr-xr-x  1 root root   530 12月 13 02:57 pgtypes_error.h
-rwxr-xr-x  1 root root   222 12月 13 02:57 pgtypes.h
-rwxr-xr-x  1 root root  1164 12月 13 02:57 pgtypes_interval.h
-rwxr-xr-x  1 root root  2249 12月 13 02:57 pgtypes_numeric.h
-rwxr-xr-x  1 root root  1031 12月 13 02:57 pgtypes_timestamp.h
-rwxr-xr-x  1 root root  2144 12月 13 02:57 postgres_ext.h
drwxr-xr-x  5 root root    52 12月 17 11:24 postgresql
-rwxr-xr-x  1 root root   834 12月 13 02:57 sql3types.h
-rwxr-xr-x  1 root root  1276 12月 13 02:57 sqlca.h
-rwxr-xr-x  1 root root  1583 12月 13 02:57 sqlda-compat.h
-rwxr-xr-x  1 root root   317 12月 13 02:57 sqlda.h
-rwxr-xr-x  1 root root   820 12月 13 02:57 sqlda-native.h
-rwxr-xr-x  1 root root  3715 12月 13 02:57 zstd_errors.h
-rwxr-xr-x  1 root root 94270 12月 13 02:57 zstd.h

本篇接着介紹剩餘的內容。首先還是先來看一下軟件包下面的所有目錄情況。

[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 目錄

由於 Greenplum 是基於 PostgreSQL 內核開發的,所以一些 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
............
............
............

從上面的具體庫文件命名也可以看出,有一部分 greenplum 的動態鏈接庫也是放在這裏面的,具體原因我也不知道,等諮詢官方開發大神再給大家更新。

lib/python 目錄

該目錄下放的是 python 用到的庫文件,例如:yaml、pygresql,這裏面比較重要的一個就是 pygresql,這是 python 語言訪問 postgresql 係數據庫的三方接口庫,現在用的比較多的具有相同作用的庫還有 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 等等,可以說我們在 Greenplum 數據庫中執行創建擴展語句 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 軟件包目錄暢遊部分到此結束~歡迎各位朋友拍磚~

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章