Central Server HA Migration
This article explains how to migrate from a Central Server HA setup (<= v6.22) that uses PostgreSQL 9.4 with BDR 1.0.x to an external PostgreSQL database cluster.
This article is only for Central Server versions <= v6.22.
The migration is completed by following the steps below.
Take a backup of the Central Servers.
Update Central Servers to version 6.23.0 (or later). See Central Server High Availability Installation Guide for instructions.
Verify that
center.ha-node-name
is configured in/etc/xroad/conf.d/local.ini
(on each server).
Create the destination database using DB super-user privileges:
psql --host=<host> --username=<super-user, e.g. postgres> <<EOF create user centerui password '<password>'; grant centerui to postgres; -- required e.g. by AWS RDS because the managed super-user does not have full privileges create database centerui_production owner centerui; \c centerui_production create extension hstore; EOF
Stop Central Servers.
Alternatively, one can leave the servers running but any modifications to the configuration (e.g. new Security Server registrations) during the upgrade are lost.
Take a dump of the Central Server database:
Note the destination database version (e.g. PostgreSQL 10.10).
If necessary, install a version of the postgresql-client package that has the same major version as the destination database (e.g. postgresql-client-10).
If a suitable version is not available from Ubuntu package repositories, please see https://www.postgresql.org/download/linux/ubuntu/
Use the pg_dump version that has the same major version as the destination database. Do not use pg_dump from the BDR version of PostgreSQL.
/usr/lib/postgresql/<major version>/bin/pg_dump --host=localhost --username=centerui --no-privileges --no-owner --schema=public --exclude-table=xroad_bdr_replication_info --dbname=centerui_production --format=c -f center.dmp
Restore the dump to the new database:
Use pg_restore that has the same major version as the destination database./usr/lib/postgresql/<major version>/bin/pg_restore --list center.dmp | sed '/FUNCTION public get_xroad_bdr_replication_info()/d' >center.list /usr/lib/postgresql/<major version>/bin/pg_restore --host=<host> --username=centerui --dbname=centerui_production --no-owner --single-transaction --use-list=center.list center.dmp psql --host=<host> --username=centerui --dbname=centerui_production -c "select fix_sequence();"
Update the configuration file
/etc/xroad/db.properties
with information about the new database.(Re)start Central Servers.
If the local PosgreSQL is not used by other applications, stop the local instance and prevent it from starting:
Related articles