GreenPlum

Administrator
发布于 2023-12-29 / 17 阅读
0
0

GreenPlum

GreenPlum

1. 安装

1.1. MAC 环境安装GreenPlum

下载源码

	git clone https://github.com/greenplum-db/gpdb.git

按照README.macOS.md的步骤做

	1. Install needed dependencies
	2. Allow ssh to use the version of python in path, not the system python
	3. Enable ssh to localhost without requiring a password
	4. Configure, compile, and install

不想把MAC环境搞乱可以继续下去

原则:直接编译安装,缺什么装什么即可

configure

	cd gpdb
	CPPFLAGS=-I/usr/local/Cellar/xerces-c/3.2.5/include LDFLAGS="-L/usr/local/Cellar/xerces-c/3.2.5/lib -L/usr/local/Cellar/zstd/1.5.5/lib" ./configure --with-perl --with-python --with-libxml --with-gssapi --prefix=/Users/john-y/CLionProjects/gpdb/install --disable-gpfdist

缺少库,就是用brew 安装,我这里主要缺少的就是xerces-c,找不到头文件和库路径,头文件放到CPPFLAGS,库路径放到LDPATH,实在是用不到的东西,可以禁用,例如--disable-gpfdist,禁用gpfdist

make

	make -j8

有问题回到configure 按照需要的东西

make install

	make install -j8

配置本地的gp库

	cd gpAux/gpdemo
	make

有问题就参考README.macOS.md,需要安装iproute2mac并修改别名和python相关的库

	brew install iproute2mac
	sudo ln -s /usr/sbin/netstat /usr/local/bin/ss

	pip3 install --user -r python-dependencies.txt

启动

	source install/greenplum_path.sh  
    source gpAux/gpdemo/gpdemo-env.sh
	gpstart -a

连接

	psql postgres

2. 日志时区问题

	gpconfig -c log_timezone -v 'Asia/Shanghai'

3. minirepro

在SQL崩溃的集群收集SQL相关的元数据和统计信息,在另一个集群导入并复现,主要解决优化器崩溃

	minirepro --help                                                               
	Usage: minirepro <database> [options]
	
	Options:
	  --version             show program's version number and exit
	  -?, --help            Show this help message and exit
	  -h HOST, --host=HOST  Specify a remote host
	  -p PORT, --port=PORT  Specify a port other than 5432
	  -U USER, --user=USER  Connect as someone other than current user
	  -q QUERY_FILE         file name that contains the query
	  -f OUTPUT_FILE        minirepro output file name
	  -l, --hll             Include HLL stats
	
	WARNING: This tool collects statistics about your data, including most common
	values, which requires some data elements to be included in the output file.
	Please review output file to ensure it is within corporate policy to transport
	the output file.

收集

	minirepro postgres -q query.sql -h localhost -U john-y -f test.out 

元数据和统计信息导入

	psql -f test.out

复现


评论