Greenplum 7已发布了Beta 5版本,可谓是千呼万唤始出来啊。但是现在还没到正式切换的时候,于是在现有Greenplum 6的集群中,同时安装了Greenplum 7 Beta 5。 一、集群环境:
主机 | IP | Role |
---|---|---|
mdw | 10.10.10.180 | Master |
sdw1 | 10.10.10.181 | Data |
sdw2 | 10.10.10.182 | Data |
sdw3 | 10.10.10.183 | Data |
操作系统:Red Hat Linux 8.8 Enterprise 注意:Greenplum7只能安装在Red Hat Linux 8.6及以上,以及其他同等版本操作系统上。 安装过程略。 二、版本切换过程
- 停止当前版本Greenplum
gpstop -M fast
- 切换到root用户,执行以下操作
[root@mdw local]# cd /usr/local # 此步骤进入greenplum安装路径
[root@mdw local]# ll # 查看路径下内容,当前生效的是GP7
total 8
drwxr-xr-x. 2 root gpadmin 23 Aug 16 20:35 bin
drwxr-xr-x. 2 root gpadmin 6 Jun 21 2021 etc
drwxr-xr-x. 2 root gpadmin 6 Jun 21 2021 games
lrwxrwxrwx. 1 gpadmin gpadmin 36 Aug 15 19:25 greenplum-db -> /usr/local/greenplum-db-7.0.0-beta.5
drwxr-xr-x. 11 gpadmin gpadmin 4096 Aug 15 19:22 greenplum-db-6.25.1
drwxr-xr-x. 11 gpadmin gpadmin 4096 Aug 15 18:58 greenplum-db-7.0.0-beta.5
drwxr-xr-x. 2 root gpadmin 6 Jun 21 2021 include
drwxr-xr-x. 2 root gpadmin 6 Jun 21 2021 lib
drwxr-xr-x. 3 root gpadmin 17 Aug 15 02:43 lib64
drwxr-xr-x. 2 root gpadmin 6 Jun 21 2021 libexec
drwxr-xr-x. 2 root gpadmin 6 Jun 21 2021 sbin
drwxr-xr-x. 6 root gpadmin 60 Aug 16 20:35 share
drwxr-xr-x. 2 root gpadmin 6 Jun 21 2021 src
[root@mdw local]# rm greenplum-db # 删除当前软链接
rm: remove symbolic link 'greenplum-db'? y
[root@mdw local]# ln -s /usr/local/greenplum-db-6.25.1 greenplum-db # 建立新的软链接
[root@mdw local]# chown -R gpadmin:gpadmin /usr/local/green* # 文件夹授权
[root@mdw local]# ll # 检查文件夹下所有文件
total 8
drwxr-xr-x. 2 root gpadmin 23 Aug 16 20:35 bin
drwxr-xr-x. 2 root gpadmin 6 Jun 21 2021 etc
drwxr-xr-x. 2 root gpadmin 6 Jun 21 2021 games
lrwxrwxrwx 1 gpadmin gpadmin 30 Aug 17 02:36 greenplum-db -> /usr/local/greenplum-db-6.25.1
drwxr-xr-x. 11 gpadmin gpadmin 4096 Aug 15 19:22 greenplum-db-6.25.1
drwxr-xr-x. 11 gpadmin gpadmin 4096 Aug 15 18:58 greenplum-db-7.0.0-beta.5
drwxr-xr-x. 2 root gpadmin 6 Jun 21 2021 include
drwxr-xr-x. 2 root gpadmin 6 Jun 21 2021 lib
drwxr-xr-x. 3 root gpadmin 17 Aug 15 02:43 lib64
drwxr-xr-x. 2 root gpadmin 6 Jun 21 2021 libexec
drwxr-xr-x. 2 root gpadmin 6 Jun 21 2021 sbin
drwxr-xr-x. 6 root gpadmin 60 Aug 16 20:35 share
drwxr-xr-x. 2 root gpadmin 6 Jun 21 2021 src
- 切换回gpadmin用户,修改.bashrc
source /usr/local/greenplum-db/greenplum_path.sh
export COORDINATOR_DATA_DIRECTORY=/data/coordinator/gpseg-1 # 此为GP7的路径
export MASTER_DATA_DIRECTORY=/data/master/gpseg-1 # 此处为GP6的路径
export PGPORT=5432
export PGUSER=gpadmin
export PGDATABASE=gpdb
export LD_PRELOAD=/lib64/libz.so.1 ps
- 启动Greenplum
[gpadmin@mdw ~]$ gpstart -a
20230817:02:52:15:018920 gpstart:mdw:gpadmin-[INFO]:-Starting gpstart with args: -a
20230817:02:52:15:018920 gpstart:mdw:gpadmin-[INFO]:-Gathering information and validating the environment...
20230817:02:52:15:018920 gpstart:mdw:gpadmin-[INFO]:-Greenplum Binary Version: 'postgres (Greenplum Database) 6.25.1 build commit:337d85331f0330dea32d229f450da438d5e948f6'
20230817:02:52:15:018920 gpstart:mdw:gpadmin-[INFO]:-Greenplum Catalog Version: '301908232'
20230817:02:52:15:018920 gpstart:mdw:gpadmin-[INFO]:-Starting Master instance in admin mode
20230817:02:52:15:018920 gpstart:mdw:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information
20230817:02:52:15:018920 gpstart:mdw:gpadmin-[INFO]:-Obtaining Segment details from master...
20230817:02:52:15:018920 gpstart:mdw:gpadmin-[INFO]:-Setting new master era
20230817:02:52:15:018920 gpstart:mdw:gpadmin-[INFO]:-Master Started...
20230817:02:52:15:018920 gpstart:mdw:gpadmin-[INFO]:-Shutting down master
20230817:02:52:17:018920 gpstart:mdw:gpadmin-[INFO]:-Commencing parallel segment instance startup, please wait...
.
20230817:02:52:18:018920 gpstart:mdw:gpadmin-[INFO]:-Process results...
20230817:02:52:18:018920 gpstart:mdw:gpadmin-[INFO]:-----------------------------------------------------
20230817:02:52:18:018920 gpstart:mdw:gpadmin-[INFO]:- Successful segment starts = 12
20230817:02:52:18:018920 gpstart:mdw:gpadmin-[INFO]:- Failed segment starts = 0
20230817:02:52:18:018920 gpstart:mdw:gpadmin-[INFO]:- Skipped segment starts (segments are marked down in configuration) = 0
20230817:02:52:18:018920 gpstart:mdw:gpadmin-[INFO]:-----------------------------------------------------
20230817:02:52:18:018920 gpstart:mdw:gpadmin-[INFO]:-Successfully started 12 of 12 segment instances
20230817:02:52:18:018920 gpstart:mdw:gpadmin-[INFO]:-----------------------------------------------------
20230817:02:52:18:018920 gpstart:mdw:gpadmin-[INFO]:-Starting Master instance mdw directory /data/master/gpseg-1
20230817:02:52:18:018920 gpstart:mdw:gpadmin-[INFO]:-Command pg_ctl reports Master mdw instance active
20230817:02:52:18:018920 gpstart:mdw:gpadmin-[INFO]:-Connecting to dbname='template1' connect_timeout=15
20230817:02:52:18:018920 gpstart:mdw:gpadmin-[INFO]:-No standby master configured. skipping...
20230817:02:52:18:018920 gpstart:mdw:gpadmin-[INFO]:-Database successfully started
验证版本,没问题:
[gpadmin@mdw ~]$ psql -d postgres
psql (9.4.26)
Type "help" for help.
postgres=# select * from version();
version
------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
PostgreSQL 9.4.26 (Greenplum Database 6.25.1 build commit:337d85331f0330dea32d229f450da438d5e948f6) on x86_64-unknown-linux-gnu, co
mpiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-18), 64-bit compiled on Jul 19 2023 21:09:20
(1 row)
postgres=#
备注: 本例中是从Greenplum 7切换回Greenplum 6。如果需要再从Greenplum 6切换回Greenplum 7,只需重复以上步骤即可。也可做一个sh文件,直接执行后切换,更方便。此处不做赘述。