How to upgrade Apigee Edge OPDK Analytics Postgres Slave Node

Problem: When I try to upgrade my postgres slave node after upgrading all other Apigee components, I get the error that the database in read only mode and the upgrade fails to complete.

Solution: In order to upgrade the postgres slave, replication needs to be disabled. Steps to do this:

1. From your slave postgres, you need to take it out of read only mode by touching a trigger_file, like this:

touch /opt/apigee4/data/postgresql/pgdata/trigger_file

note: replace /opt with your apigee install location

2. proceed with the upgrade of the postgres slave node with the Apigee Edge upgrade scripts:

sudo ./apigee-install.sh

then:

sudo /opt/apigee4/share/installer/apigee-upgrade.sh

3. Once the upgrade completes, you will need to reestablish the postgres replication. Go to the master postgres, and check ssh connectivity to the slave server from the apigee user ssh apigee@slave-ip. This should now allow connectivity from the master to the slave without a password. Repeat this step on the slave postgres by running ssh apigee@master-ip. If you are able to connect, all is good.

4. Stop postgres slave:

/opt/apigee4/bin/all-stop.sh

5. Now we reestablish replication. On your master, run:

/opt/apigee4/share/installer/apigee-postgres-replication-setup.sh

it will prompt:

select m for master

specify the slave ip

specify the location to your id_rsa key.

specify the data directory

This will establish replication and sync up the data between master and slave. If you have a lot of data, this can take some time. I went through this with a customer with 5Gb of data in their postgres, and the sync took 30 minutes.

Wait for the script to complete fully before proceeding to the next steps.

6. On postgres slave, start postgresql:

/opt/apigee4/bin/all-start.sh

Then run the script:

/opt/apigee4/share/installer/apigee-postgres-replication-setup.sh

select s for slave

specify the ip of master

specify the id_rsa location

specify the data directory

7. Check from the postgres master:

/opt/apigee4/bin/postgres-check-master.sh

validate that it says it is the master.

8. Check the standby is the slave:

/opt/apigee4/bin/postgres-check-standby.sh

NOTE: When upgrading the postgres slave, the postgres master can remain enabled to serve live traffic without any analytics data lost. To learn more about zero downtime upgrades, see the document Apigee Edge Install and Configuration Guide.

Comments
akashtp
Staff

@Janice Hunt Is there any specific check that to be performed in order to verify that replication is working properly?

akashtp
Staff

To verify the replication status you can issue the following scripts on both servers. The system should display identical results on both servers to ensure a successful replication.

On the master node, run /<inst-root>/apigee4/bin/postgres-check-master.sh 
On the standby node, run /<inst-root>/apigee4/bin/postgres-check-standby.sh 

Postgres Server determines its state - active or standby by querying whether the postgres db running on the machine is master or standby.

This has two implications:

- Postgres Server starts successfully on the machine where postgresql db is already running.

- When the role of postgresql db changes from standby to master or vice versa, the respective Postgres Server must be restarted to detect the new state.

Version history
Last update:
‎02-27-2015 10:58 AM
Updated by: