- Linux OS
- Old version: 9.4
- New version: 11
Steps:
- Install postgres 11 via yum or apt
- Running both versions simulteneously
/usr/lib/postgresql/9.4/bin/pg_ctl start -D /var/lib/postgresql/11/main -o "-c config_file=/etc/postgresql/9.4/main/postgresql.conf"
#Edit postgresql.conf for new port such as 5433
/usr/lib/postgresql/11/bin/pg_ctl start -D /var/lib/postgresql/11/main -o "-c config_file=/etc/postgresql/11/main/postgresql.conf"
- Stop any version
#Postgres 9.4
/usr/lib/postgresql/9.4/bin/pg_ctl stop -D /var/lib/postgresql/11/main
#Postgres 11
/usr/lib/postgresql/11/bin/pg_ctl start -D /var/lib/postgresql/11/main
- Inplace upgrade
/usr/lib/postgresql/11/bin/pg_upgrade --old-bindir /usr/lib/postgresql/9.4/bin --new-bindir /usr/lib/postgresql/11/bin --old-datadir /var/lib/postgresql/9.4/main --new-datadir /var/lib/postgresql/11/main -o ' -c config_file=/etc/postgresql/9.4/main/postgresql.conf' -O ' -c config_file=/etc/postgresql/11/main/postgresql.conf'
postgres@erogluproddb:~$ /usr/lib/postgresql/11/bin/pg_upgrade --old-bindir /usr/lib/postgresql/9.4/bin --new-bindir /usr/lib/postgresql/11/bin --old-datadir /var/lib/postgresql/9.4/main --new-datadir /var/lib/postgresql/11/main -o ' -c config_file=/etc/postgresql/9.4/main/postgresql.conf' -O ' -c config_file=/etc/postgresql/11/main/postgresql.conf'
Performing Consistency Checks
-----------------------------
Checking cluster versions ok
Checking database user is the install user ok
Checking database connection settings ok
Checking for prepared transactions ok
Checking for reg* data types in user tables ok
Checking for contrib/isn with bigint-passing mismatch ok
Checking for invalid "unknown" user columns ok
Checking for roles starting with "pg_" ok
Creating dump of global objects ok
Creating dump of database schemas
ok
Checking for presence of required libraries ok
Checking database user is the install user ok
Checking for prepared transactions ok
If pg_upgrade fails after this point, you must re-initdb the
new cluster before continuing.
Performing Upgrade
------------------
Analyzing all rows in the new cluster ok
Freezing all rows in the new cluster ok
Deleting files from new pg_xact ok
Copying old pg_clog to new server ok
Setting next transaction ID and epoch for new cluster ok
Deleting files from new pg_multixact/offsets ok
Copying old pg_multixact/offsets to new server ok
Deleting files from new pg_multixact/members ok
Copying old pg_multixact/members to new server ok
Setting next multixact ID and offset for new cluster ok
Resetting WAL archives ok
Setting frozenxid and minmxid counters in new cluster ok
Restoring global objects in the new cluster ok
Restoring database schemas in the new cluster
ok
Copying user relation files
ok
Setting next OID for new cluster ok
Sync data directory to disk ok
Creating script to analyze new cluster ok
Creating script to delete old cluster ok
Checking for hash indexes ok
Upgrade Complete
----------------
Optimizer statistics are not transferred by pg_upgrade so,
once you start the new server, consider running:
./analyze_new_cluster.sh
Running this script will delete the old cluster's data files:
./delete_old_cluster.sh
Hiç yorum yok:
Yorum Gönder