Created
December 15, 2021 08:21
-
-
Save cedricbonhomme/f94b0ea046ab31391c462e8b1c694605 to your computer and use it in GitHub Desktop.
PostgreSQL server migration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ locate bin/postgres | |
/usr/lib/postgresql/10/bin/postgres | |
/usr/lib/postgresql/12/bin/postgres | |
/usr/lib/postgresql/9.5/bin/postgres | |
$ sudo pg_lsclusters | |
$ mkdir backup-pg | |
$ sudo cp -R /var/lib/postgresql/9.5 backup-pg | |
$ sudo systemctl stop postgresql.service | |
$ sudo systemctl stop [email protected] | |
$ sudo systemctl stop [email protected] | |
$ cd /tmp | |
$ sudo -H -u postgres /usr/lib/postgresql/12/bin/pg_upgrade \ | |
-b /usr/lib/postgresql/9.5/bin \ | |
-B /usr/lib/postgresql/12/bin \ | |
-d /var/lib/postgresql/9.5/main \ | |
-D /var/lib/postgresql/12/main \ | |
-o ' -c config_file=/etc/postgresql/9.5/main/postgresql.conf' \ | |
-O ' -c config_file=/etc/postgresql/12/main/postgresql.conf' | |
$ sudo systemctl start postgresql.service | |
$ sudo ./analyze_new_cluster.sh | |
$ sudo ./delete_old_cluster.sh | |
$ # delete and clean old data.... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment