Upgrading Greenplum Database from 4.2.x.x to 4.3
Planning Your Upgrade
Before you begin your upgrade, make sure the master and all segments (data directories and filespace) have at least 2GB of free space. Prior to upgrading your database, it is recommends that you run a pre-upgrade check to verify your database is healthy. You can perform a pre-upgrade check by executing the gpmigrator (_mirror) utility with the --check-only option.
For example:
source $new_gphome/greenplum_path.sh;
gpmigrator_mirror --check-only $old_gphome $new_gphome
Note: Performing a pre-upgrade check of your database with the gpmigrator (_mirror) utility should done during a database maintenance period. When the utility
checks the database catalog, users cannot access the database.
See also: Troubleshooting a Failed Upgrade
Migrating a Greenplum Database That Contains AO Tables
The migration process updates AO tables that are in a Greenplum Database to UAO tables. For a database that contains a large number of AO tables, the conversion to UAO tables might take a considerable amount of time.
Upgrade Procedure
a) Pre-upgrade preparation
b) Software installation,
c) Upgrade execution,
d) Post-upgrade tasks.
See Upgrade Checklist that summarizes this procedure.
It is recommended to evaluate each section and perform all required and conditional steps. Failing to perform any of these steps can result in an aborted upgrade, placing your system in an unusable or even unrecoverable state.
a) Pre-Upgrade Preparation (on your 4.2.x system)
Perform these steps on your current 4.2.x Greenplum Database system. This procedure is performed from your Greenplum master host and should be executed by the Greenplum superuser (gpadmin).
1.Log in to the Greenplum Database master as the gpadmin user:
$ su - gpadmin
2.(optional) Vacuum all databases prior to upgrade. For example:
$ vacuumdb database_name
3.(optional) Clean out old server log files from your master and segment data directories. For example, to remove log files from 2011 from your segment hosts:
$ gpssh -f seg_host_file -e 'rm /gpdata/*/gp*/pg_log/gpdb-2011-*.csv'
Note: Running Vacuum and cleaning out old logs files is not required, but it will reduce the size of Greenplum Database files to be backed up and migrated.
4.Run gpstate to check for failed segments.
$ gpstate
5.If you have failed segments, you must recover them using gprecoverseg before you can upgrade.
$ gprecoverseg
Note: It might be necessary to restart the database if the preferred role does not match the current role; for example, if a primary segment is acting as a mirror segment or a mirror segment is acting as a primary segment.
6.Copy or preserve any additional folders or files (such as backup folders) that you have added in the Greenplum data directories or $GPHOME directory. Only files or folders strictly related to Greenplum Database operations are preserved by the migration utility.
b) Install the Greenplum Database 4.3 Software Binaries
1.Download or copy the installer file to the Greenplum Database master host.
2.Unzip the installer file. For example:
# unzip greenplum-db-4.3-PLATFORM.zip
3.Launch the installer using bash. For example:
# /bin/bash greenplum-db-4.3-PLATFORM.bin
4.The installer will prompt you to accept the Greenplum Database license agreement. Type yes to accept the license agreement.
5.The installer will prompt you to provide an installation path. Press ENTER to accept the default install path (for example: /usr/local/greenplum-db-4.3), or enter an absolute path to an install location. You must have write permissions to the location you specify.
6.The installer installs the Greenplum Database software and creates a greenplum-db symbolic link one directory level above your version-specific Greenplum installation directory. The symbolic link is used to facilitate patch maintenance and upgrades between versions. The installed location is referred to as $GPHOME.
7.Source the path file from your new 4.3 installation. For example:
$ source /usr/local/greenplum-db-4.3/greenplum_path.sh
8.Run the gpseginstall utility to install the 4.3 binaries on all the segment hosts specified in the hostfile. For example:
$ gpseginstall -f hostfile
c) Upgrade Execution
During upgrade, all client connections to the master will be locked out. Inform all database users of the upgrade and lockout time frame. From this point onward, users should not be allowed on the system until the upgrade is complete.
9.Source the path file from your old 4.2.x.x installation. For example:
$ source /usr/local/greenplum-db-4.2.6.3/greenplum_path.sh
10.Back up all databases in your Greenplum Database system using gpcrondump (or zfs snapshots on Solaris systems). See the Greenplum Database Administrator Guide for more information on how to do backups using gpcrondump. Make sure to secure your backup files in a location outside of your Greenplum data directories. This step is optional but strongly recommended.
11.If your system has a standby master host configured, remove the standby master from your system configuration. For example:
$ gpinitstandby -r
12.Perform a clean shutdown of your current Greenplum Database 4.2.x.x system. For example:
$ gpstop
13.Source the path file from your new 4.3 installation. For example:
$ source /usr/home/greenplum-db-4.3/greenplum_path.sh
14.Update the Greenplum Database environment so it is referencing your new 4.3 installation.
a.For example, update the greenplum-db symbolic link on the master and standby master to point to the new 4.3 installation directory. For example (as root):
# rm -rf /usr/local/greenplum-db
# ln -s /usr/local/greenplum-db-4.3 /usr/local/greenplum-db
# chown -R gpadmin /usr/local/greenplum-db
b.Using gpssh, also update the greenplum-db symbolic link on all of your segment hosts. For example (as root):
# gpssh -f segment_hosts_file
=> rm -rf /usr/local/greenplum-db
=> ln -s /usr/local/greenplum-db-4.3 /usr/local/greenplum-db
=> chown -R gpadmin /usr/local/greenplum-db
=> exit
15.(optional but recommended) Prior to running the migration, perform a pre-upgrade check to verify that your database is healthy by executing the 4.3 version of the gpmigrator utility with the --check-only option. For example:
# gpmigrator_mirror --check-only /usr/local/greenplum-db-4.2.6.3 /usr/local/greenplum-db-4.3
16.As gpadmin, run the 4.3 version of the migration utility specifying your old and new GPHOME locations. If your system has mirrors, use gpmigrator_mirror. If your system does not have mirrors, use gpmigrator. For example on a system with mirrors:
$ su - gpadmin
$ gpmigrator_mirror /usr/local/greenplum-db-4.2.6.3 /usr/local/greenplum-db-4.3
Note: If the migration does not complete successfully, contact Customer Support
17.The migration can take a while to complete. After the migration utility has completed successfully, the Greenplum Database 4.3 system will be running and accepting connections.
Note: After the migration utility has completed, the resynchronization of the mirror segments with the primary segments continues. Even though the system is running, the mirrors are not active until the resynchronization is complete.
d) Post-Upgrade (on your 4.3 system)
18.If your system had a standby master host configured, reinitialize your standby master using gpinitstandby:
$ gpinitstandby -s standby_hostname
19.If your system uses external tables with gpfdist, stop all gpfdist processes on your ETL servers and reinstall gpfdist using the compatible Greenplum Database 4.3 Load Tools package. Application Packages are available at the EMC Download Center.
20.Rebuild any custom modules against your 4.3 installation (for example, any shared library files for user-defined functions in $GPHOME/lib).
21.Use the Greenplum Database gppkg utility to install Greenplum Database extensions. If you were previously using any Greenplum Database extensions such as pgcrypto, PL/R, PL/Java, PL/Perl, and PostGIS, download the corresponding packages from the EMC Download Center, and install using this new utility. See the Greenplum Database Administrator Guide 4.3 for usage details.
22.If you want to utilize the Greenplum Command Center management tool, install the latest Command Center Console and update your environment variable to point to the latest Command Center binaries (source the gpperfmon_path.sh file from your new installation).
Note that the Greenplum Command Center management tool replaces Greenplum Performance Monitor. Command Center Console packages are available from the EMC Download Center.
23.Inform all database users of the completed upgrade. Tell users to update their environment to source the Greenplum Database 4.3 installation (if necessary).