当前Greenplum只支持在CentOS6/7上安装,所以如果要在CentOS8上安装还需要解决一些依赖问题,本文就带大家从一个最简单的CentOS8开始,用源码尝试编译并安装GPDB6。本文不涉及GPORCA部分。
源码下载
我们假设,当前您已经有一个已经安装好的CentOS8主机环境,并且已经配置好网络访问。
首先从GitHub上拿到GPDB 6.x的最新源码发布包,如下:
下载命令类似如下:
wget https://github.com/greenplum-db/gpdb/releases/download/6.19.0/6.19.0-src-full.tar.gz
源码编译
源码编译的具体操作,如果大家不理解,可以参考 https://github.com/greenplum-db/gpdb
README的介绍,这里不展开讨论。
configure部分问题
执行README.CentOS.bash
脚本的问题解决:
问题:
No match for argument: libyaml-devel
No match for argument: python-devel
No match for argument: python-pip
软件包 zlib-devel-1.2.11-13.el8.x86_64 已安装。
错误:没有任何匹配: libyaml-devel python-devel python-pip
sudo: pip:找不到命令
sudo: pip:找不到命令
sudo: pip:找不到命令
解决:可以修改bash脚本的yum内容,或者直接手工安装,以下为手工安装步骤
sudo yum install python2-devel
sudo yum install python2-pip
sudo yum install libyaml.i686
sudo ln -s /usr/bin/python2 /usr/bin/python
sudo ln -s /usr/bin/pip2 /usr/bin/pip
configure命令执行样例:
tar -xzvf 6.19.0.tar.gz
cd gpdb-6.19.0
./configure --with-perl --with-python --with-libxml --with-gssapi --prefix=/usr/local/gpdb --disable-orca
问题:
checking whether g++ supports C++11 features with +std=c++0x... no
checking whether g++ supports C++11 features with -h std=c++0x... no
configure: error: *** A compiler with support for C++11 language features is required.
解决:
sudo yum install gcc-c++
问题:
configure: WARNING:
*** Without Bison you will not be able to build PostgreSQL from Git nor
*** change any of the parser definition files. You can obtain Bison from
*** a GNU mirror site. (If you are using the official distribution of
*** PostgreSQL then you do not need to worry about this, because the Bison
*** output is pre-generated.)
解决:
sudo yum install bison
问题:
configure: WARNING:
*** Without Flex you will not be able to build PostgreSQL from Git nor
*** change any of the scanner definition files. You can obtain Flex from
*** a GNU mirror site. (If you are using the official distribution of
*** PostgreSQL then you do not need to worry about this because the Flex
*** output is pre-generated.)
解决:
sudo yum install flex
问题:
checking for flags to link embedded Perl... Can't locate ExtUtils/Embed.pm in @INC (you may need to install the ExtUtils::Embed module) (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5).
BEGIN failed--compilation aborted.
no
configure: error: could not determine flags for linking embedded Perl.
This probably means that ExtUtils::Embed or ExtUtils::MakeMaker is not
installed.
解决:
sudo yum install perl-ExtUtils-Embed.noarch
问题:
checking for library containing readline... no
configure: error: readline library not found
If you have readline already installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-readline to disable readline support.
解决:
sudo yum install readline-devel
问题:
checking for ZSTD_compressCCtx in -lzstd... no
configure: error: zstd library not found
If you have libzstd already installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-zstd to disable zstd support.
解决:
sudo yum install libzstd
sudo yum install libzstd-devel
问题:
checking for library containing gss_init_sec_context... no
configure: error: could not find function 'gss_init_sec_context' required for GSSAPI
解决:
sudo yum install krb5-devel
问题:
checking for apr-1-config... no
configure: error: apr-1-config is required for gpfdist, unable to find binary
解决:
sudo yum install apr-devel
问题:
checking for library containing event_add... no
configure: error: libevent is required for gpfdist
解决:
sudo yum install libevent-devel
问题:
checking for xmlSaveToBuffer in -lxml2... no
configure: error: library 'xml2' (version >= 2.6.23) is required for XML support
解决:
sudo yum install libxml2-devel
问题:
checking for curl-config... no
*** The curl-config script could not be found. Make sure it is
*** in your path, and that curl is properly installed.
*** Or see http://curl.haxx.se/
configure: error: Library requirements (curl) not met.
解决:
sudo yum install libcurl-devel
问题:
checking for BZ2_bzDecompress in -lbz2... no
configure: error: library 'bz2' is required for bzip2 support
解决:
sudo yum install bzip2-devel
问题:
checking for strnicmp in -lxerces-c... no
configure: error: library xerces-c is required to build with Pivotal Query Optimizer
解决:
sudo yum install xerces-c-devel
make部分问题
问题:
In file included from include/reader.h:4,
from include/gpreader.h:4,
from src/gpcloud.cpp:38:
include/s3common_headers.h:8:10: 致命错误:openssl/hmac.h:No such file or directory
#include <openssl/hmac.h>
^~~~~~~~~~~~~~~~
解决:
sudo yum install openssl-devel
如果安装完依赖库后,make失败,可以尝试make clean后再make。
安装测试
# make当前已经成功完成,尝试安装
sudo make install
执行初始化相关步骤,测试是否可用:
source /usr/local/gpdb/greenplum_path.sh
gpssh-exkeys -f hostfile #此步骤要求已经配置/etc/hosts中的主机名对应关系,hostfile文件中是本机主机名
mkdir -p ~/gpdata/primary
mkdir ~/gpdata/master
gpinitsystem -c cluster.conf -h hostfile # 简单的cluster.conf贴在下面
psql -d postgres
# create table t1(id int); insert into t1 select generate_series(1,100); select * from t1 limit 10;
如果执行互信认证过程中,遇到以下问题,请安装psutil:
[parallels@ct8-1 ~]$ gpssh-exkeys -f hostfile
Error: unable to import module: No module named psutil
推出当前已经生效的环境,或者用root安装psutil
解决:
sudo pip install psutil
cluster.conf文件内容参考:
[parallels@ct8-1 ~]$ cat cluster.conf
CLUSTER_NAME="gpdb"
SEG_PREFIX=gp
PORT_BASE=40000
DATA_DIRECTORY=(/home/parallels/gpdata/primary /home/parallels/gpdata/primary)
MASTER_DIRECTORY=/home/parallels/gpdata/master
MASTER_HOSTNAME=ct8-1
MASTER_PORT=5432
IP_ALLOW=0.0.0.0/0
TRUSTED_SHELL=/usr/bin/ssh
CHECK_POINT_SEGMENTS=8
ENCODING=UNICODE