在CentOS7上编译GreenPlum5.3.0

Step.1 为yum添加国内镜像源

下载阿里镜像源

$ cd /etc/yum.repos.d
$ sudo wget -nc http://mirrors.aliyun.com/repo/Centos-7.repo

将阿里镜像源设为默认源

$ sudo mv CentOS-Base.repo CentOS-Base.repo.bak
$ sudo cp Centos-7.repo CentOS-Base.repo

清除yum机制的本地缓存

$ sudo yum clean all
$ sudo yum makecache
$ sudo yum list
$ sudo yum -y update

Step.2 使用yum安装依赖的系统库

$ sudo yum install curl-devel bzip2-devel python-devel openssl-devel

Step.3 使用pip安装以来的Python库

$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo python get-pip.py
$ sudo pip install psi lockfile paramiko setuptools epydoc conan

Step.4 安装并使用gcc6.3作为编译器

自带的gcc4.8.5编译会报语法错误,所以安装更高版本的编译器

$ sudo yum install centos-release-scl -y
$ sudo yum install devtoolset-6-gcc devtoolset-6-gcc-c++
$ scl enable devtoolset-6 bash
$ gcc --version

Step.5 添加LIB库路径

向/etc/ld.so.conf文件中加入下面的路径
/usr/local/lib
/usr/local/lib64
$ sudo ldconfig


Greenplum缺省使用的是legacy优化器。使用此优化器参考Step6。

GPORCA是postgresql新一代的优化器,在性能上有很大提升。早期legacy是针对单节点PostgreSQL而构建的,主要应用于OLTP场景,现在的greenplum使用MPP,主要应用场景变为OLAP场景,legacy对此虽然进行了修改,但是从架构设计上,使得其维护和添加新的功能越来越困难,所以有了GPORCA优化器。使用此优化器参考Step7 - Step11。


Step.6 使用缺省的legacy优化器编译GPDB

编译GPDB源码,安装到 /home/smart/gpdb_legacy.530 目录下
从github上下载GreenPlum最新版5.3.0的源码:
https://github.com/greenplum-db/gpdb/archive/5.3.0.tar.gz

$ cd ~/gpdb-5.3.0/
$ ./configure --with-openssl --with-python --enable-debug --enable-depend --with-perl  --with-libxml --with-gssapi  --disable-orca --prefix=/home/smart/gpdb_legacy.530
$ make
$ make install

注意:make的过程中可能会报错缺少bison、flex,用yum添加即可,添加完后需要重新configure再make。

Step.7 安装cmake3.3.2

GPORCA需要Cmake3.1以上才能编译

$ wget https://cmake.org/files/v3.3/cmake-3.3.2.tar.gz
$ tar xzvf cmake-3.3.2.tar.gz  
$ cd cmake-3.3.2  
$ ./bootstrap 
$ make
$ sudo make install

Setp.8 下载并安装gp-xerces

$ cd ~
$ mkdir orca
$ cd orca
$ git clone https://github.com/greenplum-db/gp-xerces.git
$ cd gp-xerces
$ ./configure
$ make
$ sudo make install

Setp.9 下载并安装re2c

进入http://re2c.org/install/install.html下载re2c-1.0.3.tar.gz,拷贝到~/orca

$ tar -xvzf re2c-1.0.3.tar.gz
$ cd re2c-1.0.3
$ ./configure
$ make
$ sudo make install

Setp.10 下载并安装ninja

$ cd ~/orca
$ git clone https://github.com/ninja-build/ninja.git
$ cd ninja
$ ./configure.py --bootstrap

Setp.10 下载并安装GPORCA

下载https://github.com/greenplum-db/gporca/archive/v2.51.4.tar.gz

$ cd ~/orca
$ tar -xvzf v2.51.4.tar.gz
$ cd gporca-2.51.4
$ export PATH=~/orca/ninja:$PATH
$ cmake -GNinja -H. -Bbuild
$ sudo ninja install -C build
$ cd build执行ctest命令进行检查

如果最后输出类似如下结果:
100% tests passed, 0 tests failed out of 119
Total Test time (real) = 165.21 sec
表示成功。注意gpdb5.3.0支持的gporca版本是2.51.XXX,所以不要下载更新版本的GPORCA(例如2.53.XXX)

Setp.11 使用缺省的gporca优化器编译GPDB

编译GPDB源码,安装到 /home/smart/gpdb_gporca.530 目录下
从github上下载GreenPlum最新版5.3.0的源码:
https://github.com/greenplum-db/gpdb/archive/5.3.0.tar.gz

$ cd ~/gpdb-5.3.0/
$ ./configure --with-openssl --with-python --enable-debug --enable-depend --with-perl  --with-libxml --with-gssapi --prefix=/home/smart/gpdb_gporca.530
$ make
$ make install

注意:make的过程中可能会报错缺少bison、flex,用yum添加即可,添加完后需要重新configure再make。

完工!

[参考文献]
《在centos7中手动编译greenplum》
《How to build GPDB on RHEL 7》

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

皓月如我

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值