Version Upgrade

This section shows how to upgrade Oushu Database. There are three ways to upgrade:

  • Binary Replacement: Brinary replacement is the easiest way. There are no catalog and storage format changes, upgrade only need to backup your configuations, replace brinary, and copy back your configuration files.
  • Metadata Upgrade: Metadata upgrading involves changes in metadata content. It requires metadata modification.
  • Changing the Format of Incompatible Data to Upgrade: Changing the format of incompatible data to upgrade needs to re-import data. Since the data storage format do not change frequently and even though it changes, it often compatibles with previous versions, so changing the format of incompatible data to upgrade is not common.

So far Oushu Database version does not involve metadata changes and incompatible data format changes, so we only introduce binary replacement upgrade steps.

The step of binary replacement upgrade

Please note that you should leave enough time to upgrade and test, to avoid the problems which need to fall back to the old version. In addition, please backup data before the upgrade to prevent accidents.

Configure YUM repo

If it is networked, you can download Oushu Database Yum repo directly on each node.

#If the system is Redhat/CentOS 7.0, 7.1, 7.2 and contain command avx, please configure the following YUM repo :
wget -P /etc/yum.repos.d/ http://yum.oushu-tech.com/oushurepo/oushudatabaserepo/centos7/3.1.2.0/oushu-database.repo

#If the system is Redhat/CentOS 7.0, 7.1, 7.2 but don't contain command avx, please configure the following YUM repo:
wget -P /etc/yum.repos.d/ http://yum.oushu-tech.com/oushurepo/oushudatabaserepo/centos7/3.1.2.0/oushu-database-noavx.repo

#If the system is Redhat/CentOS 7.3 and contain command avx, please configure the following YUM repo:
wget -P /etc/yum.repos.d/ http://yum.oushu-tech.com/oushurepo/oushudatabaserepo/centos7/3.1.2.0/oushu-database-cent73.repo

#If the system is Redhat/CentOS 7.3 but don't contain command avx, please configure the following YUM repo:
wget -P /etc/yum.repos.d/ http://yum.oushu-tech.com/oushurepo/oushudatabaserepo/centos7/3.1.2.0/oushu-database-cent73-noavx.repo

#If the system is Redhat/CentOS 7.4 and contain command avx, please configure the following YUM repo:
wget -P /etc/yum.repos.d/ http://yum.oushu-tech.com/oushurepo/oushudatabaserepo/centos7/3.1.2.0/oushu-database-cent74.repo

#If the system is Redhat/CentOS 7.4 but don't contain command avx, please configure the following YUM repo:
wget -P /etc/yum.repos.d/ http://yum.oushu-tech.com/oushurepo/oushudatabaserepo/centos7/3.1.2.0/oushu-database-cent74-noavx.repo

If it is non-networking, you can download the new installation package from Oushu Lava and configure the local source on each node.

mkdir -p /data1/localrepo
cd /data1/localrepo
tar xzf oushu-database-full-3.0.1.0-rhel7-x86_64.tar.gz
yum -y install httpd
systemctl start httpd
chown -R apache:root /data1/localrepo

/data1/localrepo/oushu-database-full-3.0.1.0/setup_repo.sh

Then we need to disable Selinux. Clear and rebuild YUM cache.

# Disable Selinux
setenforce 0

# Clear and rebuild YUM cache
yum clean all
yum makecache

Stop Oushu Database

Log in the server via gpadmin user on master node:

hawq stop cluster -a
# If there has running query, and you want to stop Oushu Database immediately,you can use:
hawq stop cluster -a -M immediate

Backup the configuration file

On master node:

cd /usr/local/hawq
cp -r etc /home/gpadmin

Remove the old version of Oushu Database

Log in the server via root user and execute the following command(the hostfile contains all server names of Oushu Database installation node):

hawq ssh -f hostfile -e 'yum -y remove hawq'

Install the new version of Oushu Database

Log in the server via root user and execute the following command:

hawq ssh -f hostfile -e 'yum -y install hawq'

Copy back configuration files

Log in the server via gpadmin user:

cd /home/gpadmin
cp -r etc/ /usr/local/hawq
hawq scp -r -f hostfile /usr/local/hawq/etc =:/usr/local/hawq

Start Oushu Database

hawq start cluster -a

Check after upgrade

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
psql -d postgres

# Check if it is the latest version:
postgres=# select version();

# Create table and insert data to test:

postgres=# create table t(i int, j int);
postgres=# insert into t values(1,2),(2,3),(3,4);
postgres=# select * from t;

The step of binary catalog change upgrade

Please note that you should leave enough time to upgrade and test, to avoid the problems which need to fall back to the old version. In addition, please backup data before the upgrade to prevent accidents.

binary upgrade first

Before do the catalog upgrade, you need to do the binary upgrade first.

Stop Oushu Database

Log in the server via gpadmin user on master node:

hawq stop cluster -a
# If there has running query, and you want to stop Oushu Database immediately,you can use:
hawq stop cluster -a -M immediate

Backup the master node file

On master node:

cp -r <hawq-data-directory> /home/gpadmin
# <hawq-data-directory> is the guc value you set in the hawq-site.xml

change the catalog table

On master node:

hawq start master
# start the master node first

hawq config -c gp_maintenance_conn -v true --skipvalidation
#set upgrade gun value

hawq start master -U upgrade
#start the master node in upgrade mode

psql -U gpadmin
#login as super user

#if you want to change the catalog table like pg_authid when upgrade from 3.1.2 to 3.2.0, run the following sql:
alter table pg_authid add column rolcreaterexthive bool;
alter table pg_authid add column rolcreatewexthive bool;

hawq stop master
hawq start cluster -a
#quit upgrade mode and restart the cluster

#the catalog change is over, you can use oushu database in normal mode