I'm trying to migrate postgres from version 11 to version 14 First have a look at this documentation
Logical replication continously streams the replication line-by-line, cincluding any changes being written to the database during the migration, until the replication is stopped.
When testing a PostgreSQL major upgrade, consider the following categories of possible changes:
- Administration -- The capabilities available for administrators to monitor and control the server often change and improve in each major release.
- SQL -- Typically this includes new SQL command capabilities and not changes in behavior, unless specificall6y mentioned in the release notes.
- Library API -- Typically libraries like libpq only add new functionality, again unless mentioned in the release notes.
- System Catalogs -- System catalog changes usually only affect database management tools.
- Server C-language API -- This involves changes in the backed function API, which is written in the C programming language. Such changes affect code that references backend functions deep inside the server.
To dump data from one major of PostgreSQL and reload it in another, you must use pg_dump
; file system level backup methods will not work.
(There are checks in place that prevent you from using a data directory with an incompatible version of PostgreSQL, so no great harm can be done by trying to start
the wrong server version on a data directory.)
it is recommended that you use the pg_dump
and pg_dumpall
programs from the newer version of PostgreSQL, to take advantage of
enhancements that might have been made in these programs. Current releases of the dump programs can read
data from any server version back to 7.0.
The least downtime can be achieved by installing the new server in a different directory and running boith the old and the new servers in parallel, on different ports. Then you can use something like:
pg_dumpall -p 5432 | psql -d postgres -p 6432
to transfer your data. Or yuou can use an intermediate file if you wish. Then you
can shut down the old server and start the new sever using the port the old one was running on.
You should make sure that the old database is not updated after you begin to run pg_dumpall
,
otherwise you will lose those udpates.
the contrib program pg_upgrade
allows an installation to be migrate in-place from one major PostgreSQL version to the next. Keep in mind that
this method does not provide any scope for running old and new versions concurrently.
Also, pg_upgrade
is much less battle-tested than pg_dump
, so having an up-to-date backup is strongly recommended incase something goes wrong.
I will do the traditional method, meaning dump/reload method.
Install postgres 14:
To backup your database installation:
pg_dumpall > outputfile
Sorry for now, i finish my work, deadline coming. I promise I will go back to this one day.