GreenPlum6源码编译安装ORCA优化器
参考 https://github.com/greenplum-db/gporca
ORCA 是PostgreSQL的下一代优化器,在QUERY的优化上比自带的优化器更先进。
1.安装cmake
$ wget https://cmake.org/files/v3.16/cmake-3.16.4.tar.gz
$ tar -zxvf cmake-3.16.4.tar.gz
$ cd cmake-3.16.4
$ ./configure --prefix=/home/jerome/cmake
$ make && make install
$ export PATH=/home/jerome/cmake/bin:$PATH
2.安装GPOS
$ cd ~
$ git clone https://github.com/greenplum-db/gpos
$ cd gpos
$ mkdir build && cd build
$ cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/home/jerome/gpos_home ../
$ make install
3.安装gp-xerces
$ cd ~
$ git clone https://github.com/greenplum-db/gp-xerces
$ cd gp-xerces
$ mkdir build && cd build
$ ../configure --prefix=/home/jerome/gp-xerces_home
$ make -j 32 && make install
4.安装gporca
$ cd ~
$ git clone https://github.com/greenplum-db/gporca.git
$ cd gporca
$ mkdir build && cd build
$ cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/home/jerome/gporca_home \
-D XERCES_INCLUDE_DIR=/home/jerome/gp-xerces_home/include \
-D XERCES_LIBRARY=/home/jerome/gp-xerces_home/lib/libxerces-c.so ../
$ make -j 32 && make install
5.安装greenplum6.0
$ git clone https://github.com/greenplum-db/gpdb.git
$ cd gpdb
$ ./configure --prefix=/home/jerome/gp \
--enable-orca --with-perl \
--with-python --with-libxml \
--with-includes=/home/jerome/gporca_home/include:/home/jerome/gpos_home/include:/home/jerome/gp-xerces_home/include \
--with-libraries=/home/jerome/gporca_home/lib:/home/jerome/gpos_home/lib:/home/jerome/gp-xerces_home/lib
上面编译命令提示错误如下:
checking Checking ORCA version... configure: error:
Your ORCA version is expected to be 3.88.XXX
于是重新下载一个3.88.1的orca版本
重新安装完后还是报上面的错
仔细查看错误日志文件,发现下面一行
$ cat config.log |more
./conftest: error while loading shared libraries: libgpopt.so.3: cannot open shared object file: No such file or directory
大概知道是so未找到,并不是提示的orca版本的问题,于是设置环境变量如下:
$ export LD_LIBRARY_PATH=/home/jerome/gpos_home/lib:\
/home/jerome/gp-xerces_home/lib:\
/home/jerome/gporca_home/lib:\
$LD_LIBRARY_PATH
重新编译configure通过,然后继续安装
$ make -j 32 && make install
相关文章