A simple bash script to upgrade postgresql on redhat based systems(RHEL, CentOS 6/7).
Requirements
- New postgresql packages should already be installed.
- Old postgresql service should be stopped in read-write mode. (If you are using hotstandby mode, remove recovery file then start-stop postgresql service)
How to?
- Stop old postgresql service.
- Install new Postgresql Packages.
- Run the script with root user.
- Remove the old Postgresql packages.
- Remove old data dir.
Validations
- Tested on Centos 6.5, centos 7.5 and RHEL 7.5
- Tested migration of Postgresql9.3 to postgresql-10.
- Following are the test cases results
Data dir size | script runtime |
---|---|
14GB | 3.2 Mins |
248GB | 19 Mins |
20GB | 4 Min |