在CentOS7上编译GreenPlum5.3.0
Step.1 為yum添加國內(nèi)鏡像源
下載阿里鏡像源
$ cd /etc/yum.repos.d $ sudo wget -nc http://mirrors.aliyun.com/repo/Centos-7.repo將阿里鏡像源設(shè)為默認(rèn)源
$ 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 updateStep.2 使用yum安裝依賴的系統(tǒng)庫
$ sudo yum install curl-devel bzip2-devel python-devel openssl-develStep.3 使用pip安裝以來的Python庫
$ wget https://bootstrap.pypa.io/get-pip.py $ sudo python get-pip.py $ sudo pip install psi lockfile paramiko setuptools epydoc conanStep.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 --versionStep.5 添加LIB庫路徑
向/etc/ld.so.conf文件中加入下面的路徑
/usr/local/lib
/usr/local/lib64
$ sudo ldconfig
Greenplum缺省使用的是legacy優(yōu)化器。使用此優(yōu)化器參考Step6。
GPORCA是postgresql新一代的優(yōu)化器,在性能上有很大提升。早期legacy是針對單節(jié)點PostgreSQL而構(gòu)建的,主要應(yīng)用于OLTP場景,現(xiàn)在的greenplum使用MPP,主要應(yīng)用場景變?yōu)镺LAP場景,legacy對此雖然進(jìn)行了修改,但是從架構(gòu)設(shè)計上,使得其維護(hù)和添加新的功能越來越困難,所以有了GPORCA優(yōu)化器。使用此優(yōu)化器參考Step7 - Step11。
Step.6 使用缺省的legacy優(yōu)化器編譯GPDB
編譯GPDB源碼,安裝到 /home/smart/gpdb_legacy.530 目錄下
從github上下載GreenPlum最新版5.3.0的源碼:
https://github.com/greenplum-db/gpdb/archive/5.3.0.tar.gz
注意: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 installSetp.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 installSetp.9 下載并安裝re2c
進(jìn)入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 installSetp.10 下載并安裝ninja
$ cd ~/orca $ git clone https://github.com/ninja-build/ninja.git $ cd ninja $ ./configure.py --bootstrapSetp.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執(zhí)行ctest命令進(jìn)行檢查如果最后輸出類似如下結(jié)果:
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優(yōu)化器編譯GPDB
編譯GPDB源碼,安裝到 /home/smart/gpdb_gporca.530 目錄下
從github上下載GreenPlum最新版5.3.0的源碼:
https://github.com/greenplum-db/gpdb/archive/5.3.0.tar.gz
注意:make的過程中可能會報錯缺少bison、flex,用yum添加即可,添加完后需要重新configure再make。
完工!
[參考文獻(xiàn)]
《在centos7中手動編譯greenplum》
《How to build GPDB on RHEL 7》
總結(jié)
以上是生活随笔為你收集整理的在CentOS7上编译GreenPlum5.3.0的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: CentOS安装高版本gcc
- 下一篇: 怎么选择u盘引导 如何挑选适合的U盘进行