How to Clean up Postgres 9.3 Data¶
Customer Managed Applies to customer-managed instances of Alation
This section applies to Alation instances that were continuously updated from versions before V R5 (5.10.x) to newer versions and where the internal Postgres database (Rosemeta) was upgraded from version 9.3 to version 9.6.
Note
This section does not apply to instances where the initial installation was done on version V R6 (5.12.x) or newer.
Postgres 9.3 data still exists on instances updated from V R5 (5.10.x). It is possible to remove the legacy Postgres 9.3 data from the instance and free disk space.
Important
Delete the Postgres 9.3 data only after at least 90 days have passed from the moment when the internal Postgres database was upgraded from 9.3 to 9.6. This period is required for the data migration between the old and newer versions of Postgres to be fully complete.
Prerequisites¶
Check if the Legacy 9.3 Postgres Data Exists on the Instance¶
As the root user, check if the directory /data1/pgsql/9.3/data/ exists on the instance:
SSH to the Alation host and enter the Alation shell:
sudo /etc/init.d/alation shell
Change user to
root
:sudo su
Go to /data1/pgsql/9.3/data/ and list the contents:
cd /data1/pgsql/9.3/data/ # List the contents ls
Exit out of the root user:
exit
Verify the Active Postgres Version¶
Important
Only delete the Postgres 9.3 data if the current active Postgres version on the instance is 9.6.
To verify the active Postgres version from the Alation shell with the command given below.
Note
Before running this command, make sure you have exited out of the root user back to
alationadmin
.alation_psql
This command should return version 9.6 as the active Postgres version. Type \q
to exit the Postgres shell.
Clean up Postgres 9.3 Data¶
To delete the 9.3 Postgres data from an Alation instance,
Still in the Alation shell, check if the directory and file /data2/pg_upgrade/rosemeta/pg_upgrade_log/delete_old_cluster.sh exist on the instance. This script should have been created after the Postgres upgrade to version 9.6.
cd /data2/pg_upgrade/rosemeta/pg_upgrade_log/
If the script does not exist, see Delete Postgres 9.3 Data Manually below.
If the script exists, next, make sure that the Postgres 9.3 service is stopped:
sudo service postgresql-9.3 stop
Run the delete_old_cluster.sh script to delete the Postgres 9.3 data. After the script has run, the directory /data1/pgsql/9.3/data/ should be removed.
sudo ./delete_old_cluster.sh
Manually delete the leftover folders in the 9.3 directory to complete the clean-up:
sudo rm -rf /data1/pgsql/9.3/
Delete Postgres 9.3 Data Manually¶
If the delete_old_cluster.sh script is not available on the instance, you can manually delete the Postgres 9.3 directory from the Alation Chroot. Alation did not observe any issues when it was removed manually.
To manually delete the Postgres 9.3 data,
From the Alation shell, make sure that the Postgres 9.3 services are stopped:
sudo service postgresql-9.3 stop
Manually remove the contents of the 9.3 directory:
sudo rm -rf /data1/pgsql/9.3/