Greenplum upgrade from 4.3.4.1 to 4.3.30.0

这一篇主要介绍升级,升级步骤

1.切换至gpadmin用户,关闭仓库

2.在主节点运行4.3.30.0的bin文件

3.升级使用的是软连接,所以只要建立相关目录的软连接即可

4.在所有segment节点安装软件

5.检查C语言库文件

6.启动仓库

1.关闭仓库
su - gpadmin
gpstop -M fast
2.解压并在master节点安装新版本的greenplum
unzip greenplum-db-4.3.30.0-rhel5-x86_64.zip
./greenplum-db-4.3.30.0-rhel5-x86_64.bin
3.删除原软连接,新建软件连
这里需要切换到root用户操作
rm -rf /opt/greenplum-db
ln -s /opt/greenplum-db-4.3.30.0 /opt/greenplum-db
4.在所有节点安装greenplum
gpseginstall -f hostfile   --这里hostfile是所有segment节点的列表
也可以不使用gpseginstall,使用gpscp将安装在master节点的GP目录打包然后复制到每个segment节点,然后解压,赋予目录权限即可
其实这里gpseginstall做的也是以上工作,只不过是封装在脚本里面了而已。
以下需要在root用户下操作
cd /opt
tar -cf greenplum-db-4.3.30.0.tar greenplum-db-4.3.30.0
gpscp -f /home/gpadmin/nonmaster_host_file greenplum-db-4.3.30.0.tar  =:/opt     --这里nonmaster_host_file是所有segment节点的列表
然后通过gpssh -f /home/gpadmin/nonmaster_host_file连接至每一个节点
cd /opt
tar -xf greenplum-db-4.3.30.0.tar
chown -R gpadmin.gpadmin greenplum-db-4.3.30.0
chown -R gpadmin.gpadmin greenplum-db
全部完成以后,启动GP
su - gpadmin
gpstart

其实升级并不复杂,主要是升级过程中遇到一些问题导致升级中断,检查问题,以下记录以下遇到的问题
1.启动报错
2018-10-31 07:09:29.818076 GMT,,,p7822,th-1773975776,,,,0,,,seg-1,,,,,"FATAL","XX000","Unknown interconnect type. (current type is 'UDPIFC') (cdbvars.c:968)",,,,,,,,"gpvars_assign_gp_interconnect_type","cdbvars.c",968,1    0xb076b2 postgres <symbol not found> (elog.c:502)
2    0xb096c8 postgres elog_finish (elog.c:1446)
3    0xcd5ba8 postgres gpvars_assign_gp_interconnect_type (cdbvars.c:968)
4    0xb2e4cb postgres <symbol not found> (guc.c:9802)
5    0xb34de6 postgres set_config_option (guc.c:10361)
6    0xb379ef postgres SelectConfigFiles (guc-file.l:163)
7    0x8fc9bd postgres PostmasterMain (postmaster.c:1138)
8    0x7fd1bf postgres main (main.c:206)
9    0x3ce661ed1d libc.so.6 __libc_start_main + 0xfd
10   0x4bee19 postgres <symbol not found> + 0x4bee19

这里修改参数即可解决:gpconfig -c gp_interconnect_type -v UDPIFC -m UDPIFC 
2.正常启动后,psql无法连接报错
psql: FATAL:  DTM initialization: failure during startup recovery, retry failed, check segment status
我这里需要修改shared_buffer参数到合适范围即可
3.执行相关函数报错
select encode(users)  from  test  limit 1;

org.postgresql.util.PSQLException: ERROR: could not access file "codec.so": No such file or directory
这里报错codec.so不存在,对比了之前4.3.4.1的目录,确实少了c语言函数,于是复制相关.so文件到新版本目录下
我这里少了一下.so文件,需要复制到每个节点(master+segment)
cp sd.so se.so skycodec.so uuid.so codec2.so codec3.so codec.so /opt/greenplum-db-4.3.30.0/lib/postgresql/

复制完成后,重启GP,查询还是报错,无法正常使用encode和decode

warehouse=# select encode(users) from test limit 1;
ERROR:  incompatible library "/opt/greenplum-db-4.3.29.0/lib/postgresql/codec.so": version mismatch (dfmgr.c:385)  (seg10 slice1 xxxxxxxxx:xxxx pid=27123) (cdbdisp.c:1322)
DETAIL:  Server version is Greenplum 4.3 (header version: 1), library is Greenplum 4.3 (header version: 0).

查看GP源代码如下:
/*
	 * If the version doesn't match, just report that, because the rest of the
	 * block might not even have the fields we expect.
	 */
	if (magic_data.version != module_magic_data->version ||
		magic_data.product != module_magic_data->product ||
		magic_data.headerversion != lib_internal_version)
	{
		ereport(ERROR,
				(errmsg("incompatible library \"%s\": version mismatch",
						libname),
			  errdetail("Server version is %s %d.%d (header version: %d), library is %s %d.%d (header version: %d).",
						magic_product,
						magic_data.version / 100,
						magic_data.version % 100,
						magic_data.headerversion,
						mod_magic_product,
						module_magic_data->version / 100,
						module_magic_data->version % 100,
						lib_internal_version)
				)
		);
	}

重新编译相关c文件sd.so se.so skycodec.so uuid.so codec2.so codec3.so codec.so
这里codec升级过,所以在编译到.so文件用了不同的名字,注意修改-I参数问实际的GP安装目录
 gcc -m64 -O3 -funroll-loops -fargument-noalias-global -g -finline-limit=1800 -Wall -Wmissing-prototypes -Wpointer-arith  -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -fwrapv -I /opt/greenplum-db-4.3.30.0/include -fpic -I. -I /opt/greenplum-db-4.3.30.0/include/postgresql/server -I/opt/greenplum-db-4.3.30.0/include/postgresql/internal -D_GNU_SOURCE   -c -o skycodec.o skycodec.c

 gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -fwrapv -fpic -L/opt/greenplum-db-4.3.30.0/lib -Wl,-rpath,'/opt/greenplum-db-4.3.30.0/lib',--enable-new-dtags  -shared -o skycodec.so skycodec.o
复制编译后的文件到新版本GP目录
启动GP,使用encode和decode函数均正常。

参考:

https://gpdb.docs.pivotal.io/43300/relnotes/GPDB_43300_README.html#topic17

https://community.pivotal.io/s/article/How-to-Upgrade-Pivotal-Greenplum-inside-family-from-43-to-later

https://github.com/greenplum-db/gpdb/blob/master/src/backend/utils/fmgr/dfmgr.c

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值